summaryrefslogtreecommitdiff
path: root/perf/cpp
diff options
context:
space:
mode:
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;
}