From 1f1a6f18b68401ff6fcb3a8b921202f6395961d4 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Wed, 8 Nov 2017 16:13:34 +0800 Subject: [PATCH] tool: use coarse_mono_clock in ceph-kvstore-tool Signed-off-by: Chang Liu --- src/tools/ceph_kvstore_tool.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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; } -- 2.47.3