]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
log: fix timestap precision of log can't set to millisecond. 37659/head
authorIvanGuan <yunfei.guan@xtaotech.com>
Wed, 4 Mar 2020 13:04:03 +0000 (21:04 +0800)
committerNathan Cutler <ncutler@suse.com>
Tue, 13 Oct 2020 18:04:56 +0000 (20:04 +0200)
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>
(cherry picked from commit a5cceeac48066dc6b0b4a21133cfdcb920d159e8)

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 9ecde2887ea39cf50f2c401faaae7cc1591d0e63..85b8ba22a87677118d24a9c0378c33e35aae88a5 100644 (file)
@@ -61,9 +61,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 a0b12e274323172cc4b7eeacb8ade39df05f4d0e..c66053c556614f6d2635536d179bf23be0abad72 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;