From: Xinze Chi Date: Sun, 4 Oct 2015 23:44:14 +0000 (+0800) Subject: common: add latency perf counter for finisher X-Git-Tag: v10.0.2~172^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2c049897d70bb46c33af57f8b61f696a6dfd982d;p=ceph.git common: add latency perf counter for finisher Signed-off-by: Xinze Chi --- diff --git a/src/common/Finisher.cc b/src/common/Finisher.cc index 7ebbe05622b..9b39dc888e3 100644 --- a/src/common/Finisher.cc +++ b/src/common/Finisher.cc @@ -44,9 +44,12 @@ void *Finisher::finisher_thread_entry() finisher_lock.Lock(); ldout(cct, 10) << "finisher_thread start" << dendl; + utime_t start; while (!finisher_stop) { /// Every time we are woken up, we process the queue until it is empty. while (!finisher_queue.empty()) { + if (logger) + start = ceph_clock_now(cct); // To reduce lock contention, we swap out the queue to process. // This way other threads can submit new contexts to complete while we are working. vector ls; @@ -73,8 +76,10 @@ void *Finisher::finisher_thread_entry() c->complete(ls_rval.front().second); ls_rval.pop_front(); } - if (logger) + if (logger) { logger->dec(l_finisher_queue_len); + logger->tinc(l_finisher_complete_lat, ceph_clock_now(cct) - start); + } } ldout(cct, 10) << "finisher_thread done with " << ls << dendl; ls.clear(); diff --git a/src/common/Finisher.h b/src/common/Finisher.h index 87674459903..95db977a0ea 100644 --- a/src/common/Finisher.h +++ b/src/common/Finisher.h @@ -27,6 +27,7 @@ class CephContext; enum { l_finisher_first = 997082, l_finisher_queue_len, + l_finisher_complete_lat, l_finisher_last }; @@ -146,9 +147,11 @@ class Finisher { PerfCountersBuilder b(cct, string("finisher-") + name, l_finisher_first, l_finisher_last); b.add_u64(l_finisher_queue_len, "queue_len"); + b.add_time_avg(l_finisher_complete_lat, "complete_latency"); logger = b.create_perf_counters(); cct->get_perfcounters_collection()->add(logger); logger->set(l_finisher_queue_len, 0); + logger->set(l_finisher_complete_lat, 0); } ~Finisher() {