Skip to content

Commit

Permalink
common: OpTracker age histogram calculation is not correct
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
wonzhq committed Sep 10, 2015
1 parent 8218fd1 commit 567dd1e
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/common/TrackedOp.cc
Expand Up @@ -242,12 +242,8 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &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);
Expand All @@ -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)
Expand Down

0 comments on commit 567dd1e

Please sign in to comment.