diff --git a/src/common/TrackedOp.cc b/src/common/TrackedOp.cc index 7aa6a000af1..013a66456fe 100644 --- a/src/common/TrackedOp.cc +++ b/src/common/TrackedOp.cc @@ -221,12 +221,11 @@ void OpTracker::get_age_ms_histogram(pow2_hist_t *h) h->set_bin(bin, count); } -void OpTracker::mark_event(TrackedOp *op, const string &dest) +void OpTracker::mark_event(TrackedOp *op, const string &dest, utime_t time) { if (!tracking_enabled) return; - utime_t now = ceph_clock_now(cct); - return _mark_event(op, dest, now); + return _mark_event(op, dest, time); } void OpTracker::_mark_event(TrackedOp *op, const string &evt, @@ -254,6 +253,9 @@ void OpTracker::RemoveOnDelete::operator()(TrackedOp *op) { void TrackedOp::mark_event(const string &event) { + if (!tracker->tracking_enabled) + return; + utime_t now = ceph_clock_now(g_ceph_context); { Mutex::Locker l(lock); diff --git a/src/common/TrackedOp.h b/src/common/TrackedOp.h index ae42d701489..9a06d12791c 100644 --- a/src/common/TrackedOp.h +++ b/src/common/TrackedOp.h @@ -65,6 +65,7 @@ class OpTracker { OpHistory history; float complaint_time; int log_threshold; + void _mark_event(TrackedOp *op, const string &evt, utime_t now); public: bool tracking_enabled; @@ -95,8 +96,8 @@ public: * @return True if there are any Ops to warn on, false otherwise. */ bool check_ops_in_flight(std::vector &warning_strings); - void mark_event(TrackedOp *op, const string &evt); - void _mark_event(TrackedOp *op, const string &evt, utime_t now); + void mark_event(TrackedOp *op, const string &evt, + utime_t time = ceph_clock_now(g_ceph_context)); void on_shutdown() { Mutex::Locker l(ops_in_flight_lock); diff --git a/src/mds/Mutation.h b/src/mds/Mutation.h index d211238f2d5..ed3f0fa0d47 100644 --- a/src/mds/Mutation.h +++ b/src/mds/Mutation.h @@ -297,11 +297,11 @@ struct MDRequestImpl : public MutationImpl, public TrackedOp { waited_for_osdmap(false), _more(NULL) { in[0] = in[1] = NULL; if (!params.throttled.is_zero()) - tracker->_mark_event(this, "throttled", params.throttled); + tracker->mark_event(this, "throttled", params.throttled); if (!params.all_read.is_zero()) - tracker->_mark_event(this, "all_read", params.all_read); + tracker->mark_event(this, "all_read", params.all_read); if (!params.dispatched.is_zero()) - tracker->_mark_event(this, "dispatched", params.dispatched); + tracker->mark_event(this, "dispatched", params.dispatched); } ~MDRequestImpl(); diff --git a/src/osd/OpRequest.cc b/src/osd/OpRequest.cc index 2262ab85391..8e2ffb27979 100644 --- a/src/osd/OpRequest.cc +++ b/src/osd/OpRequest.cc @@ -28,10 +28,10 @@ OpRequest::OpRequest(Message *req, OpTracker *tracker) : } else if (req->get_type() == MSG_OSD_SUBOP) { reqid = static_cast(req)->reqid; } - tracker->_mark_event(this, "header_read", request->get_recv_stamp()); - tracker->_mark_event(this, "throttled", request->get_throttle_stamp()); - tracker->_mark_event(this, "all_read", request->get_recv_complete_stamp()); - tracker->_mark_event(this, "dispatched", request->get_dispatch_stamp()); + tracker->mark_event(this, "header_read", request->get_recv_stamp()); + tracker->mark_event(this, "throttled", request->get_throttle_stamp()); + tracker->mark_event(this, "all_read", request->get_recv_complete_stamp()); + tracker->mark_event(this, "dispatched", request->get_dispatch_stamp()); } void OpRequest::_dump(utime_t now, Formatter *f) const