Problem: Throughput calculation underestimates slow messages

Solution: Use a double for messages per second and calculate
Megabits per second using it.  Truncate messages per second
only in the reported output.
This commit is contained in:
Jake Cobb
2017-08-10 14:30:22 -04:00
parent 78b26d7ac2
commit 84ab771808

View File

@@ -49,7 +49,7 @@ int main (int argc, char *argv [])
zmq_msg_t msg; zmq_msg_t msg;
void *watch; void *watch;
unsigned long elapsed; unsigned long elapsed;
unsigned long throughput; double throughput;
double megabits; double megabits;
int curve = 0; int curve = 0;
@@ -138,7 +138,7 @@ int main (int argc, char *argv [])
return -1; return -1;
} }
throughput = (unsigned long) throughput =
((double) message_count / (double) elapsed * 1000000); ((double) message_count / (double) elapsed * 1000000);
megabits = ((double) throughput * message_size * 8) / 1000000; megabits = ((double) throughput * message_size * 8) / 1000000;