Merge pull request #28801 from ideepika/wip-update-dump-historic-ops

osd: add duration field to dump_historic_ops method

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
Reviewed-by: Mark Nelson <mnelson@redhat.com>
This commit is contained in:
Kefu Chai 2019-07-11 18:27:52 +08:00 committed by GitHub
commit 969457d239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 11 deletions

View File

@ -190,10 +190,9 @@ public:
{
typename T::Ref retval(new T(params, this));
retval->tracking_start();
if (is_tracking()) {
retval->mark_event("header_read", params->get_recv_stamp());
retval->mark_event("throttled", params->get_throttle_stamp());
retval->mark_event("header_read", params->get_recv_stamp());
retval->mark_event("all_read", params->get_recv_complete_stamp());
retval->mark_event("dispatched", params->get_dispatch_stamp());
}
@ -202,7 +201,6 @@ public:
}
};
class TrackedOp : public boost::intrusive::list_base_hook<> {
private:
friend class OpHistory;

View File

@ -30,12 +30,13 @@ using std::stringstream;
using ceph::Formatter;
OpRequest::OpRequest(Message *req, OpTracker *tracker) :
TrackedOp(tracker, req->get_recv_stamp()),
rmw_flags(0), request(req),
hit_flag_points(0), latest_flag_point(0),
hitset_inserted(false)
{
OpRequest::OpRequest(Message* req, OpTracker* tracker)
: TrackedOp(tracker, req->get_throttle_stamp()),
rmw_flags(0),
request(req),
hit_flag_points(0),
latest_flag_point(0),
hitset_inserted(false) {
if (req->get_priority() < tracker->cct->_conf->osd_client_op_priority) {
// don't warn as quickly for low priority ops
warn_interval_multiplier = tracker->cct->_conf->osd_recovery_op_warn_multiple;
@ -64,11 +65,25 @@ void OpRequest::_dump(Formatter *f) const
f->dump_unsigned("tid", m->get_tid());
f->close_section(); // client_info
}
{
f->open_array_section("events");
std::lock_guard l(lock);
for (auto& i : events) {
f->dump_object("event", i);
for (auto i = events.begin(); i != events.end(); ++i) {
f->open_object_section("event");
f->dump_string("event", i->str);
f->dump_stream("time") << i->stamp;
auto i_next = i + 1;
if (i_next < events.end()) {
f->dump_float("duration", i_next->stamp - i->stamp);
} else {
f->dump_float("duration", events.rbegin()->stamp - get_initiated());
}
f->close_section();
}
f->close_section();
}