From: Zhiqiang Wang Date: Thu, 10 Sep 2015 02:15:24 +0000 (+0800) Subject: common: OpTracker age histogram calculation is not correct X-Git-Tag: v10.0.0~109^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=567dd1e92adbacb7edb46203a4fdf96faf98c12e;p=ceph.git common: OpTracker age histogram calculation is not correct While the TrackedOps in each sharded list are ordered, there are no order among different shared lists. Looping the sharded list one by one won't be able to get the right histogram. Instead, we can increment the bin count for each of the TrackedOp. Btw, for those TrackedOp whose age is >= 2^30 ms, they are now been put in the respective number of bits bin, instead of been put in a single bin. Signed-off-by: Zhiqiang Wang --- diff --git a/src/common/TrackedOp.cc b/src/common/TrackedOp.cc index f759894fb048..b5857d20e8a7 100644 --- a/src/common/TrackedOp.cc +++ b/src/common/TrackedOp.cc @@ -242,12 +242,8 @@ bool OpTracker::check_ops_in_flight(std::vector &warning_vector) void OpTracker::get_age_ms_histogram(pow2_hist_t *h) { h->clear(); - utime_t now = ceph_clock_now(NULL); - unsigned bin = 30; - uint32_t lb = 1 << (bin-1); // lower bound for this bin - int count = 0; - + for (uint32_t iter = 0; iter < num_optracker_shards; iter++) { ShardedTrackingData* sdata = sharded_in_flight_list[iter]; assert(NULL != sdata); @@ -257,21 +253,9 @@ void OpTracker::get_age_ms_histogram(pow2_hist_t *h) !i.end(); ++i) { utime_t age = now - (*i)->get_initiated(); uint32_t ms = (long)(age * 1000.0); - if (ms >= lb) { - count++; - continue; - } - if (count) - h->set_bin(bin, count); - while (lb > ms) { - bin--; - lb >>= 1; - } - count = 1; + h->add(ms); } } - if (count) - h->set_bin(bin, count); } void OpTracker::mark_event(TrackedOp *op, const string &dest, utime_t time)