From: IvanGuan Date: Wed, 4 Mar 2020 13:04:03 +0000 (+0800) Subject: log: fix timestap precision of log can't set to millisecond. X-Git-Tag: v15.2.5~110^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bdcce088e42bb4791d469049568a993a635280ce;p=ceph.git 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 (cherry picked from commit a5cceeac48066dc6b0b4a21133cfdcb920d159e8) --- diff --git a/src/log/Entry.h b/src/log/Entry.h index a8479b53beec..536f1a9dc8a2 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 924abe983d32..68a884e7111e 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 9c7f53425b65..2947a63f133f 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;