From ca9335c52f53fa9d2170cf0eef40399005ca1451 Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Thu, 6 Apr 2017 23:35:58 +0800 Subject: [PATCH] common/Finisher: batch handle perfcounter. Signed-off-by: Jianpeng Ma --- src/common/Finisher.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/common/Finisher.cc b/src/common/Finisher.cc index 16e283e7deb..2f98fe289d5 100644 --- a/src/common/Finisher.cc +++ b/src/common/Finisher.cc @@ -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::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; -- 2.39.5