Use this instead of direct access to the Message underneath when dumping
the TrackedOp.
Signed-off-by: Greg Farnum <greg@inktank.com>
void TrackedOp::dump(utime_t now, Formatter *f) const
{
- Message *m = request;
stringstream name;
- m->print(name);
+ _dump_op_descriptor(name);
f->dump_string("description", name.str().c_str()); // this TrackedOp
f->dump_stream("received_at") << get_arrived();
f->dump_float("age", now - get_arrived());
virtual void _dump(utime_t now, Formatter *f) const {}
/// if you want something else to happen when events are marked, implement
virtual void _event_marked() {}
+ /// return a unique descriptor of the Op; eg the message it's attached to
+ virtual void _dump_op_descriptor(ostream& stream) const = 0;
public:
virtual ~TrackedOp() { assert(request); request->put(); }
}
}
+void OpRequest::_dump_op_descriptor(ostream& stream) const
+{
+ get_req()->print(stream);
+}
+
bool OpRequest::check_rmw(int flag) {
return rmw_flags & flag;
}
OpRequest(Message *req, OpTracker *tracker);
+protected:
+ void _dump_op_descriptor(ostream& stream) const;
+
public:
bool been_queued_for_pg() { return hit_flag_points & flag_queued_for_pg; }
bool been_reached_pg() { return hit_flag_points & flag_reached_pg; }