From a5cceeac48066dc6b0b4a21133cfdcb920d159e8 Mon Sep 17 00:00:00 2001 From: IvanGuan Date: Wed, 4 Mar 2020 21:04:03 +0800 Subject: [PATCH] log: fix timestap precision of log can't set to millisecond. The option log_coarse_timestamps can be set to Log::clock successfully,but the Log::clock has no effect on time accuracy because the dout_impl really use is Entry::clock.So we should set Entry::clock by log_coarse_timestamps option instead of Log:clock.In addition, i think the Log::clock can be removed because i didn't see what it was for. Fixes: https://tracker.ceph.com/issues/44409 Signed-off-by: Guan yunfei --- src/log/Entry.h | 1 - src/log/Log.cc | 4 ++-- src/log/Log.h | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/log/Entry.h b/src/log/Entry.h index a8479b53beecb..536f1a9dc8a22 100644 --- a/src/log/Entry.h +++ b/src/log/Entry.h @@ -41,7 +41,6 @@ public: pthread_t m_thread; short m_prio, m_subsys; -private: static log_clock& clock() { static log_clock clock; return clock; diff --git a/src/log/Log.cc b/src/log/Log.cc index 924abe983d322..68a884e7111ef 100644 --- a/src/log/Log.cc +++ b/src/log/Log.cc @@ -62,9 +62,9 @@ Log::~Log() void Log::set_coarse_timestamps(bool coarse) { std::scoped_lock lock(m_flush_mutex); if (coarse) - clock.coarsen(); + Entry::clock().coarsen(); else - clock.refine(); + Entry::clock().refine(); } void Log::set_flush_on_exit() diff --git a/src/log/Log.h b/src/log/Log.h index 9c7f53425b650..2947a63f133fe 100644 --- a/src/log/Log.h +++ b/src/log/Log.h @@ -33,7 +33,6 @@ class Log : private Thread static const std::size_t DEFAULT_MAX_RECENT = 10000; Log **m_indirect_this; - log_clock clock; const SubsystemMap *m_subs; -- 2.47.3