Merge pull request #2065 from somnathr/wip-sd-optracker

Pull request for optracker changes

Reviewed-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
Samuel Just 2014-07-03 13:35:23 -07:00
commit 3c03beb3d9
4 changed files with 15 additions and 12 deletions

View File

@ -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);

View File

@ -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<string> &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);

View File

@ -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();

View File

@ -28,10 +28,10 @@ OpRequest::OpRequest(Message *req, OpTracker *tracker) :
} else if (req->get_type() == MSG_OSD_SUBOP) {
reqid = static_cast<MOSDSubOp*>(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