Add msgcount option to test3_latency
This commit is contained in:
parent
717f933dff
commit
e7fb92e33a
|
@ -54,11 +54,12 @@ int main(int argc, char *argv[]) {
|
||||||
long bytecount = 0;
|
long bytecount = 0;
|
||||||
int i;
|
int i;
|
||||||
unsigned long hz_limit = 1000000;
|
unsigned long hz_limit = 1000000;
|
||||||
|
unsigned long msgcount = 10000000;
|
||||||
|
|
||||||
assert(sizeof(uint32_t) == 4);
|
assert(sizeof(uint32_t) == 4);
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
fprintf(stderr, "Usage: test1 <serverhostname> [<hz_limit>]\n");
|
fprintf(stderr, "Usage: test1 <serverhostname> [<hz_limit> [<msgcount>]]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +68,11 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
printf("hz_limit = %lu\n", hz_limit);
|
printf("hz_limit = %lu\n", hz_limit);
|
||||||
|
|
||||||
|
if (argc > 3) {
|
||||||
|
msgcount = strtoul(argv[3], NULL, 0);
|
||||||
|
}
|
||||||
|
printf("msgcount = %lu\n", msgcount);
|
||||||
|
|
||||||
{
|
{
|
||||||
struct hostent *h = gethostbyname(argv[1]);
|
struct hostent *h = gethostbyname(argv[1]);
|
||||||
if (h == NULL) {
|
if (h == NULL) {
|
||||||
|
@ -99,7 +105,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
gettimeofday(&start_time, NULL);
|
gettimeofday(&start_time, NULL);
|
||||||
|
|
||||||
for (i = 0; i < 10000000; i++) {
|
for (i = 0; i < msgcount; i++) {
|
||||||
char message[1024];
|
char message[1024];
|
||||||
size_t msglen;
|
size_t msglen;
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
Loading…
Reference in New Issue