From: Chang Liu Date: Wed, 8 Nov 2017 08:13:34 +0000 (+0800) Subject: tool: use coarse_mono_clock in ceph-kvstore-tool X-Git-Tag: v13.0.1~240^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F18815%2Fhead;p=ceph.git tool: use coarse_mono_clock in ceph-kvstore-tool Signed-off-by: Chang Liu --- diff --git a/src/tools/ceph_kvstore_tool.cc b/src/tools/ceph_kvstore_tool.cc index 6bc1786409d0..14d1d19a0974 100644 --- a/src/tools/ceph_kvstore_tool.cc +++ b/src/tools/ceph_kvstore_tool.cc @@ -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(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(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; }