summaryrefslogtreecommitdiff
path: root/perf/c
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-09-02 10:22:23 +0200
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-09-02 10:22:23 +0200
commit6a5120b1f1c48d19b777f76ac756b00fb624d110 (patch)
tree33853b4f9aaaf88bcb82a53fe3607d91d7a06ab1 /perf/c
parent72fdf47d16c8d3ecd9da657b4649978e414d775c (diff)
python extension & perf tests
Diffstat (limited to 'perf/c')
-rw-r--r--perf/c/local_thr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/perf/c/local_thr.c b/perf/c/local_thr.c
index 87c3220..b58fac3 100644
--- a/perf/c/local_thr.c
+++ b/perf/c/local_thr.c
@@ -38,6 +38,7 @@ int main (int argc, char *argv [])
struct timeval end;
uint64_t elapsed;
uint64_t throughput;
+ double megabits;
if (argc != 4) {
printf ("usage: local_thr <bind-to> <message-count> "
@@ -81,12 +82,15 @@ int main (int argc, char *argv [])
elapsed = ((uint64_t) end.tv_sec * 1000000 + end.tv_usec) -
((uint64_t) start.tv_sec * 1000000 + start.tv_usec);
-
+ if (elapsed == 0)
+ elapsed = 1;
throughput = (uint64_t) message_count * 1000000 / elapsed;
+ megabits = (double) (throughput * message_size * 8) / 1000000;
printf ("message size: %d [B]\n", (int) message_size);
printf ("message count: %d\n", (int) message_count);
printf ("mean throughput: %d [msg/s]\n", (int) throughput);
+ printf ("mean throughput: %3f [Mb/s]\n", (double) megabits);
return 0;
}