From: Pan Liu Date: Thu, 27 Oct 2016 05:08:23 +0000 (+0800) Subject: reduce the times of calling ceph_clock_now by defining a new variable "end". X-Git-Tag: v11.1.0~417^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=300196be2982673ac9c83bd7277f8981fdcd5a98;p=ceph.git reduce the times of calling ceph_clock_now by defining a new variable "end". Signed-off-by: Pan Liu pan.liu@istuary.com --- diff --git a/src/common/Finisher.cc b/src/common/Finisher.cc index 59655ff5803f..a4301f064e84 100644 --- a/src/common/Finisher.cc +++ b/src/common/Finisher.cc @@ -44,6 +44,7 @@ void *Finisher::finisher_thread_entry() finisher_lock.Lock(); ldout(cct, 10) << "finisher_thread start" << dendl; + utime_t start, end; while (!finisher_stop) { /// Every time we are woken up, we process the queue until it is empty. while (!finisher_queue.empty()) { @@ -57,14 +58,13 @@ void *Finisher::finisher_thread_entry() finisher_lock.Unlock(); ldout(cct, 10) << "finisher_thread doing " << ls << dendl; + if(logger) + start = ceph_clock_now(cct); + // Now actually process the contexts. - utime_t start; for (vector::iterator p = ls.begin(); p != ls.end(); ++p) { - if(logger) - start = ceph_clock_now(cct); - if (*p) { (*p)->complete(0); } else { @@ -79,7 +79,9 @@ void *Finisher::finisher_thread_entry() } if (logger) { logger->dec(l_finisher_queue_len); - logger->tinc(l_finisher_complete_lat, ceph_clock_now(cct) - start); + end = ceph_clock_now(cct); + logger->tinc(l_finisher_complete_lat, end - start); + start = end; } } ldout(cct, 10) << "finisher_thread done with " << ls << dendl;