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 <zhiqiang.wang@intel.com>
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);
!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)