Patchwork [PULL,7/8] rdma: print out throughput while debugging

login
register
mail settings
Submitter mrhines@linux.vnet.ibm.com
Date April 16, 2013, 2:44 a.m.
Message ID <1366080286-9288-8-git-send-email-mrhines@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/236822/
State New
Headers show

Comments

mrhines@linux.vnet.ibm.com - April 16, 2013, 2:44 a.m.
From: "Michael R. Hines" <mrhines@us.ibm.com>

It's very helpful when debugging to print out migration throughput
after each iteration round to compare the different migration
technologies.

Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
---
 migration.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch

diff --git a/migration.c b/migration.c
index 0a428f0..b378313 100644
--- a/migration.c
+++ b/migration.c
@@ -35,6 +35,9 @@ 
     do { } while (0)
 #endif
 
+#define MBPS(bytes, time) (time ? ((((double) bytes * 8)         \
+        / ((double) time / 1000.0)) / 1000.0 / 1000.0) : -1.0)
+
 enum {
     MIG_STATE_ERROR,
     MIG_STATE_SETUP,
@@ -563,8 +566,9 @@  static void *migration_thread(void *opaque)
             max_size = bandwidth * migrate_max_downtime() / 1000000;
 
             DPRINTF("transferred %" PRIu64 " time_spent %" PRIu64
-                    " bandwidth %g max_size %" PRId64 "\n",
-                    transferred_bytes, time_spent, bandwidth, max_size);
+                    " bandwidth %g throughput %f max_size %" PRId64 "\n",
+                    transferred_bytes, time_spent, bandwidth,
+                    MBPS(transferred_bytes, time_spent), max_size);
             /* if we haven't sent anything, we don't want to recalculate
                10000 is a small enough number for our purposes */
             if (s->dirty_bytes_rate && transferred_bytes > 10000) {