]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/Finisher: batch handle perfcounter.
authorJianpeng Ma <jianpeng.ma@intel.com>
Thu, 6 Apr 2017 15:35:58 +0000 (23:35 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Wed, 3 May 2017 14:13:34 +0000 (22:13 +0800)
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/common/Finisher.cc

index 16e283e7deb3232015191d344b2530f3c93ed38b..2f98fe289d51c059239575f01da81b3ad2ab3d21 100644 (file)
@@ -44,7 +44,8 @@ void *Finisher::finisher_thread_entry()
   finisher_lock.Lock();
   ldout(cct, 10) << "finisher_thread start" << dendl;
 
-  utime_t start, end;
+  utime_t start;
+  uint64_t count;
   while (!finisher_stop) {
     /// Every time we are woken up, we process the queue until it is empty.
     while (!finisher_queue.empty()) {
@@ -58,8 +59,10 @@ void *Finisher::finisher_thread_entry()
       finisher_lock.Unlock();
       ldout(cct, 10) << "finisher_thread doing " << ls << dendl;
 
-      if (logger)
+      if (logger) {
        start = ceph_clock_now();
+       count = ls.size();
+      }
 
       // Now actually process the contexts.
       for (vector<Context*>::iterator p = ls.begin();
@@ -77,15 +80,13 @@ void *Finisher::finisher_thread_entry()
          c->complete(ls_rval.front().second);
          ls_rval.pop_front();
        }
-       if (logger) {
-         logger->dec(l_finisher_queue_len);
-         end = ceph_clock_now();
-         logger->tinc(l_finisher_complete_lat, end - start);
-         start = end;
-        }
       }
       ldout(cct, 10) << "finisher_thread done with " << ls << dendl;
       ls.clear();
+      if (logger) {
+       logger->dec(l_finisher_queue_len, count);
+       logger->tinc(l_finisher_complete_lat, ceph_clock_now() - start);
+      }
 
       finisher_lock.Lock();
       finisher_running = false;