]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
lttng: Trace OpRequest
authorAdam Crume <adamcrume@gmail.com>
Sat, 14 Jun 2014 00:17:22 +0000 (17:17 -0700)
committerSage Weil <sage@redhat.com>
Thu, 21 Aug 2014 17:57:27 +0000 (10:57 -0700)
Signed-off-by: Adam Crume <adamcrume@gmail.com>
src/osd/OpRequest.cc
src/osd/OpRequest.h
src/tracing/Makefile.am
src/tracing/oprequest.tp [new file with mode: 0644]

index 7cb077291a8364cbc71c6949628edc04cba989c5..aeb2da263e978ce8809770fae62fcae150c735db 100644 (file)
@@ -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 <iostream>
@@ -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);
+}
index b9bfa9b3ef3b3335b6e5ebe5a8906a82864a45b8..b80fc3c1af2f7c86486e354c740658e507226298 100644 (file)
@@ -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<OpRequest> Ref;
+
+private:
+  void set_rmw_flags(int flags);
+  void mark_flag_point(uint8_t flag, string s);
 };
 
 typedef OpRequest::Ref OpRequestRef;
index b44ebd5349550fa3c932f13df21c7578587a11df..810989686b4269386fbd3892a84f0731fbb88643 100644 (file)
@@ -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 (file)
index 0000000..4db3030
--- /dev/null
@@ -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)
+    )
+)