]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
log: fix timestap precision of log can't set to millisecond. 33720/head
authorIvanGuan <yunfei.guan@xtaotech.com>
Wed, 4 Mar 2020 13:04:03 +0000 (21:04 +0800)
committerIvanGuan <yunfei.guan@xtaotech.com>
Wed, 4 Mar 2020 13:04:03 +0000 (21:04 +0800)
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 <yunfei.guan@xtaotech.com>
src/log/Entry.h
src/log/Log.cc
src/log/Log.h

index a8479b53beecb72ed4fd416b944304837d5359bb..536f1a9dc8a223956c3450545484794eb739b154 100644 (file)
@@ -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;
index 924abe983d322e4ed7c44586c70a934865047a2c..68a884e7111efe1706fc92ae97f54c581b58e96e 100644 (file)
@@ -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()
index 9c7f53425b650badbf63298da195a7f1d29536d2..2947a63f133fe58f1fd40d6f96720f31b070590c 100644 (file)
@@ -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;