From ae5994644c8c4784cbc5e2be3fd3d09ad68de5ed Mon Sep 17 00:00:00 2001 From: Adam Crume Date: Fri, 13 Jun 2014 17:17:22 -0700 Subject: [PATCH] lttng: Trace OpRequest Signed-off-by: Adam Crume --- src/osd/OpRequest.cc | 33 +++++++++++++++++++++++------ src/osd/OpRequest.h | 34 +++++++++--------------------- src/tracing/Makefile.am | 6 ++++-- src/tracing/oprequest.tp | 45 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 32 deletions(-) create mode 100644 src/tracing/oprequest.tp diff --git a/src/osd/OpRequest.cc b/src/osd/OpRequest.cc index 7cb077291a836..aeb2da263e978 100644 --- a/src/osd/OpRequest.cc +++ b/src/osd/OpRequest.cc @@ -1,5 +1,6 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +#include "tracing/oprequest.h" #include "OpRequest.h" #include "common/Formatter.h" #include @@ -88,9 +89,29 @@ bool OpRequest::need_class_read_cap() { bool OpRequest::need_class_write_cap() { return check_rmw(CEPH_OSD_RMW_FLAG_CLASS_WRITE); } -void OpRequest::set_read() { rmw_flags |= CEPH_OSD_RMW_FLAG_READ; } -void OpRequest::set_write() { rmw_flags |= CEPH_OSD_RMW_FLAG_WRITE; } -void OpRequest::set_class_read() { rmw_flags |= CEPH_OSD_RMW_FLAG_CLASS_READ; } -void OpRequest::set_class_write() { rmw_flags |= CEPH_OSD_RMW_FLAG_CLASS_WRITE; } -void OpRequest::set_pg_op() { rmw_flags |= CEPH_OSD_RMW_FLAG_PGOP; } -void OpRequest::set_cache() { rmw_flags |= CEPH_OSD_RMW_FLAG_CACHE; } + +void OpRequest::set_rmw_flags(int flags) { + int old_rmw_flags = rmw_flags; + rmw_flags |= flags; + tracepoint(oprequest, set_rmw_flags, reqid.name._type, + reqid.name._num, reqid.tid, reqid.inc, + flags, old_rmw_flags, rmw_flags); +} + +void OpRequest::set_read() { set_rmw_flags(CEPH_OSD_RMW_FLAG_READ); } +void OpRequest::set_write() { set_rmw_flags(CEPH_OSD_RMW_FLAG_WRITE); } +void OpRequest::set_class_read() { set_rmw_flags(CEPH_OSD_RMW_FLAG_CLASS_READ); } +void OpRequest::set_class_write() { set_rmw_flags(CEPH_OSD_RMW_FLAG_CLASS_WRITE); } +void OpRequest::set_pg_op() { set_rmw_flags(CEPH_OSD_RMW_FLAG_PGOP); } +void OpRequest::set_cache() { set_rmw_flags(CEPH_OSD_RMW_FLAG_CACHE); } + +void OpRequest::mark_flag_point(uint8_t flag, string s) { + uint8_t old_flags = hit_flag_points; + mark_event(s); + current = s; + hit_flag_points |= flag; + latest_flag_point = flag; + tracepoint(oprequest, mark_flag_point, reqid.name._type, + reqid.name._num, reqid.tid, reqid.inc, rmw_flags, + flag, s.c_str(), old_flags, hit_flag_points); +} diff --git a/src/osd/OpRequest.h b/src/osd/OpRequest.h index b9bfa9b3ef3b3..b80fc3c1af2f7 100644 --- a/src/osd/OpRequest.h +++ b/src/osd/OpRequest.h @@ -131,40 +131,22 @@ public: } void mark_queued_for_pg() { - mark_event("queued_for_pg"); - current = "queued for pg"; - hit_flag_points |= flag_queued_for_pg; - latest_flag_point = flag_queued_for_pg; + mark_flag_point(flag_queued_for_pg, "queued_for_pg"); } void mark_reached_pg() { - mark_event("reached_pg"); - current = "reached pg"; - hit_flag_points |= flag_reached_pg; - latest_flag_point = flag_reached_pg; + mark_flag_point(flag_reached_pg, "reached_pg"); } void mark_delayed(string s) { - mark_event(s); - current = s; - hit_flag_points |= flag_delayed; - latest_flag_point = flag_delayed; + mark_flag_point(flag_delayed, s); } void mark_started() { - mark_event("started"); - current = "started"; - hit_flag_points |= flag_started; - latest_flag_point = flag_started; + mark_flag_point(flag_started, "started"); } void mark_sub_op_sent(string s) { - mark_event(s); - current = s; - hit_flag_points |= flag_sub_op_sent; - latest_flag_point = flag_sub_op_sent; + mark_flag_point(flag_sub_op_sent, s); } void mark_commit_sent() { - mark_event("commit_sent"); - current = "commit sent"; - hit_flag_points |= flag_commit_sent; - latest_flag_point = flag_commit_sent; + mark_flag_point(flag_commit_sent, "commit_sent"); } utime_t get_dequeued_time() const { @@ -179,6 +161,10 @@ public: } typedef ceph::shared_ptr Ref; + +private: + void set_rmw_flags(int flags); + void mark_flag_point(uint8_t flag, string s); }; typedef OpRequest::Ref OpRequestRef; diff --git a/src/tracing/Makefile.am b/src/tracing/Makefile.am index b44ebd5349550..810989686b426 100644 --- a/src/tracing/Makefile.am +++ b/src/tracing/Makefile.am @@ -2,11 +2,13 @@ $(LTTNG_GEN_TP_PROG) $< rm -f $<.o -dist_noinst_DATA = mutex.tp osd.tp pg.tp +dist_noinst_DATA = mutex.tp oprequest.tp osd.tp pg.tp libtracepoints_la_SOURCES = \ mutex.c \ mutex.h \ + oprequest.c \ + oprequest.h \ osd.c \ osd.h \ pg.h \ @@ -17,6 +19,6 @@ libtracepoints_la_CPPFLAGS = -DTRACEPOINT_PROBE_DYNAMIC_LINKAGE libtracepoints_la_LDFLAGS = noinst_LTLIBRARIES = libtracepoints.la -BUILT_SOURCES = mutex.h osd.h pg.h +BUILT_SOURCES = mutex.h oprequest.h osd.h pg.h CLEANFILES = $(libtracepoints_la_SOURCES) diff --git a/src/tracing/oprequest.tp b/src/tracing/oprequest.tp new file mode 100644 index 0000000000000..4db3030785cc7 --- /dev/null +++ b/src/tracing/oprequest.tp @@ -0,0 +1,45 @@ +TRACEPOINT_EVENT(oprequest, set_rmw_flags, + TP_ARGS( + // osd_reqid_t + uint8_t, type, + int64_t, num, + uint64_t, tid, + int32_t, inc, + int, flag, + int, old_rmw_flags, + int, new_rmw_flags), + TP_FIELDS( + ctf_integer(uint8_t, type, type) + ctf_integer(int64_t, num, num) + ctf_integer(uint64_t, tid, tid) + ctf_integer(int32_t, inc, inc) + ctf_integer_hex(int, flag, flag) + ctf_integer_hex(int, old_rmw_flags, old_rmw_flags) + ctf_integer_hex(int, new_rmw_flags, new_rmw_flags) + ) +) + +TRACEPOINT_EVENT(oprequest, mark_flag_point, + TP_ARGS( + // osd_reqid_t + uint8_t, type, + int64_t, num, + uint64_t, tid, + int32_t, inc, + int, rmw_flags, + uint8_t, flag, + const char*, msg, + uint8_t, old_hit_flag_points, + uint8_t, new_hit_flag_points), + TP_FIELDS( + ctf_integer(uint8_t, type, type) + ctf_integer(int64_t, num, num) + ctf_integer(uint64_t, tid, tid) + ctf_integer(int32_t, inc, inc) + ctf_integer_hex(int, rmw_flags, rmw_flags) + ctf_integer_hex(uint8_t, flag, flag) + ctf_string(msg, msg) + ctf_integer_hex(uint8_t, old_hit_flag_points, old_hit_flag_points) + ctf_integer_hex(uint8_t, new_hit_flag_points, new_hit_flag_points) + ) +) -- 2.39.5