]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tool: use coarse_mono_clock in ceph-kvstore-tool 18815/head
authorChang Liu <liuchang0812@gmail.com>
Wed, 8 Nov 2017 08:13:34 +0000 (16:13 +0800)
committerChang Liu <liuchang0812@gmail.com>
Thu, 9 Nov 2017 03:16:06 +0000 (11:16 +0800)
Signed-off-by: Chang Liu <liuchang0812@gmail.com>
src/tools/ceph_kvstore_tool.cc

index 6bc1786409d0146534b34d3affd5d4d70242cf45..14d1d19a097472789ec221376e03db893474230a 100644 (file)
@@ -24,7 +24,6 @@
 #include "global/global_context.h"
 #include "global/global_init.h"
 #include "include/stringify.h"
-#include "include/utime.h"
 #include "common/Clock.h"
 #include "kv/KeyValueDB.h"
 #include "common/url_escape.h"
@@ -232,7 +231,7 @@ class StoreTool
     uint64_t total_size = 0;
     uint64_t total_txs = 0;
 
-    utime_t started_at = ceph_clock_now();
+    auto started_at = coarse_mono_clock::now();
 
     do {
       int num_keys = 0;
@@ -257,14 +256,14 @@ class StoreTool
       if (num_keys > 0)
         other->submit_transaction_sync(tx);
 
-      utime_t cur_duration = ceph_clock_now() - started_at;
-      std::cout << "ts = " << cur_duration << "s, copied " << total_keys
+      auto cur_duration = std::chrono::duration<double>(coarse_mono_clock::now() - started_at);
+      std::cout << "ts = " << cur_duration.count() << "s, copied " << total_keys
                 << " keys so far (" << stringify(si_t(total_size)) << ")"
                 << std::endl;
 
     } while (it->valid());
 
-    utime_t time_taken = ceph_clock_now() - started_at;
+    auto time_taken = std::chrono::duration<double>(coarse_mono_clock::now() - started_at);
 
     std::cout << "summary:" << std::endl;
     std::cout << "  copied " << total_keys << " keys" << std::endl;
@@ -272,7 +271,7 @@ class StoreTool
     std::cout << "  total size " << stringify(si_t(total_size)) << std::endl;
     std::cout << "  from '" << store_path << "' to '" << other_path << "'"
               << std::endl;
-    std::cout << "  duration " << time_taken << " seconds" << std::endl;
+    std::cout << "  duration " << time_taken.count() << " seconds" << std::endl;
 
     return 0;
   }