]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: show read throughput in csyn read_file
authorSage Weil <sage@newdream.net>
Tue, 8 Jul 2008 18:07:18 +0000 (11:07 -0700)
committerSage Weil <sage@newdream.net>
Tue, 8 Jul 2008 18:07:18 +0000 (11:07 -0700)
src/client/SyntheticClient.cc

index 9e1f76d3ae390f27a4d1eaecf0e55e2af5f0d037..0d654700ee25473cbeeb19798bf37fa02c3de345 100644 (file)
@@ -1824,7 +1824,7 @@ int SyntheticClient::write_file(string& fn, int size, int wrsize)   // size is i
     utime_t now = g_clock.now();
     if (now - from >= 1.0) {
       double el = now - from;
-      dout(0) << (bytes / el / 1048576.0) << " MB/sec" << dendl;
+      dout(0) << "write " << (bytes / el / 1048576.0) << " MB/sec" << dendl;
       from = now;
       bytes = 0;
     }
@@ -1834,7 +1834,7 @@ int SyntheticClient::write_file(string& fn, int size, int wrsize)   // size is i
   
   utime_t stop = g_clock.now();
   double el = stop - start;
-  dout(0) << "total " << (total / el / 1048576.0) << " MB/sec ("
+  dout(0) << "write total " << (total / el / 1048576.0) << " MB/sec ("
          << total << " bytes in " << el << " seconds)" << dendl;
 
   client->close(fd);
@@ -1901,6 +1901,10 @@ int SyntheticClient::read_file(string& fn, int size, int rdsize, bool ignoreprin
   dout(5) << "reading from " << fn << " fd " << fd << dendl;
   if (fd < 0) return fd;
 
+  utime_t from = g_clock.now();
+  utime_t start = from;
+  __u64 bytes = 0, total = 0;
+
   for (unsigned i=0; i<chunks; i++) {
     if (time_to_stop()) break;
     dout(2) << "reading block " << i << "/" << chunks << dendl;
@@ -1910,6 +1914,17 @@ int SyntheticClient::read_file(string& fn, int size, int rdsize, bool ignoreprin
       break;
     }
  
+    bytes += rdsize;
+    total += rdsize;
+
+    utime_t now = g_clock.now();
+    if (now - from >= 1.0) {
+      double el = now - from;
+      dout(0) << "read " << (bytes / el / 1048576.0) << " MB/sec" << dendl;
+      from = now;
+      bytes = 0;
+    }
+
     // verify fingerprint
     int bad = 0;
     uint64_t *p = (uint64_t*)buf;
@@ -1933,7 +1948,12 @@ int SyntheticClient::read_file(string& fn, int size, int rdsize, bool ignoreprin
     if (bad && !ignoreprint) 
       dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
   }
-  
+
+  utime_t stop = g_clock.now();
+  double el = stop - start;
+  dout(0) << "read total " << (total / el / 1048576.0) << " MB/sec ("
+         << total << " bytes in " << el << " seconds)" << dendl;
+
   client->close(fd);
   delete[] buf;