summaryrefslogtreecommitdiff
path: root/perf/cpp
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/cpp
parent72fdf47d16c8d3ecd9da657b4649978e414d775c (diff)
python extension & perf tests
Diffstat (limited to 'perf/cpp')
-rw-r--r--perf/cpp/local_thr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/perf/cpp/local_thr.cpp b/perf/cpp/local_thr.cpp
index fdcbc8d..e328117 100644
--- a/perf/cpp/local_thr.cpp
+++ b/perf/cpp/local_thr.cpp
@@ -63,12 +63,15 @@ int main (int argc, char *argv [])
uint64_t elapsed = ((uint64_t) end.tv_sec * 1000000 + end.tv_usec) -
((uint64_t) start.tv_sec * 1000000 + start.tv_usec);
-
+ if (elapsed == 0)
+ elapsed = 1;
uint64_t throughput = (uint64_t) message_count * 1000000 / elapsed;
+ double 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;
}