]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
lttng: add pg and osd tracepoints
authorNoah Watkins <noahwatkins@gmail.com>
Sat, 7 Jun 2014 16:37:39 +0000 (09:37 -0700)
committerSage Weil <sage@redhat.com>
Thu, 21 Aug 2014 17:57:27 +0000 (10:57 -0700)
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
src/osd/OSD.cc
src/osd/OpRequest.cc
src/osd/PG.cc
src/osd/ReplicatedPG.cc
src/tracing/Makefile.am
src/tracing/osd.tp [new file with mode: 0644]
src/tracing/osd.tp.c [new file with mode: 0644]
src/tracing/osd.tp.h [new file with mode: 0644]
src/tracing/pg.tp [new file with mode: 0644]
src/tracing/pg.tp.c [new file with mode: 0644]
src/tracing/pg.tp.h [new file with mode: 0644]

index a1ac5e912086dfe66697034d8e77b05dc68dd5d7..e48443d51735c25031fa74d46e4f2cc70b5a1a89 100644 (file)
 
 #include "include/assert.h"
 #include "common/config.h"
+#include "tracing/osd.tp.h"
 
 #define dout_subsys ceph_subsys_osd
 #undef dout_prefix
@@ -5526,6 +5527,11 @@ void OSD::ms_fast_dispatch(Message *m)
     return;
   }
   OpRequestRef op = op_tracker.create_request<OpRequest>(m);
+  {
+    osd_reqid_t reqid = op->get_reqid();
+    tracepoint(osd, ms_fast_dispatch, reqid.name._type,
+        reqid.name._num, reqid.tid, reqid.inc);
+  }
   OSDMapRef nextmap = service.get_nextmap_reserved();
   Session *session = static_cast<Session*>(m->get_connection()->get_priv());
   assert(session);
@@ -8279,6 +8285,14 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb )
       sdata->pg_for_processing.erase(&*(item.first));
   }  
 
+  // osd:opwq_process marks the point at which an operation has been dequeued
+  // and will begin to be handled by a worker thread.
+  {
+    osd_reqid_t reqid = op->get_reqid();
+    tracepoint(osd, opwq_process_start, reqid.name._type,
+        reqid.name._num, reqid.tid, reqid.inc);
+  }
+
   lgeneric_subdout(osd->cct, osd, 30) << "dequeue status: ";
   Formatter *f = new_formatter("json");
   f->open_object_section("q");
@@ -8289,8 +8303,14 @@ void OSD::ShardedOpWQ::_process(uint32_t thread_index, heartbeat_handle_d *hb )
   *_dout << dendl;
 
   osd->dequeue_op(item.first, op, tp_handle);
-  (item.first)->unlock();
 
+  {
+    osd_reqid_t reqid = op->get_reqid();
+    tracepoint(osd, opwq_process_finish, reqid.name._type,
+        reqid.name._num, reqid.tid, reqid.inc);
+  }
+
+  (item.first)->unlock();
 }
 
 void OSD::ShardedOpWQ::_enqueue(pair<PGRef, OpRequestRef> item) {
index a6ee3ee5dfcf99bf9993420054465a5104ae7a2b..7cb077291a8364cbc71c6949628edc04cba989c5 100644 (file)
@@ -13,7 +13,6 @@
 #include "osd/osd_types.h"
 
 
-
 OpRequest::OpRequest(Message *req, OpTracker *tracker) :
   TrackedOp(tracker, req->get_recv_stamp()),
   rmw_flags(0), request(req),
index dc10b797cd30d83168e3438be9dad248189bb839..cd411ce9600be9b6a0df627d86e0cf82b2535bb7 100644 (file)
@@ -41,6 +41,7 @@
 #include "messages/MOSDSubOp.h"
 #include "messages/MOSDSubOpReply.h"
 #include "common/BackTrace.h"
+#include "tracing/pg.tp.h"
 
 #include <sstream>
 
@@ -1721,6 +1722,12 @@ void PG::queue_op(OpRequestRef& op)
     return;
   }
   osd->op_wq.queue(make_pair(PGRef(this), op));
+  {
+    // after queue() to include any locking costs
+    osd_reqid_t reqid = op->get_reqid();
+    tracepoint(pg, queue_op, reqid.name._type,
+        reqid.name._num, reqid.tid, reqid.inc);
+  }
 }
 
 void PG::replay_queued_ops()
index 19de29b0254728840393a65bb7b94b67df0edde7..1386344d9e791155629bc0673c9982ca8e79225f 100644 (file)
@@ -57,6 +57,7 @@
 #include "json_spirit/json_spirit_value.h"
 #include "json_spirit/json_spirit_reader.h"
 #include "include/assert.h"  // json_spirit clobbers it
+#include "tracing/osd.tp.h"
 
 #define dout_subsys ceph_subsys_osd
 #define DOUT_PREFIX_ARGS this, osd->whoami, get_osdmap()
@@ -1841,8 +1842,20 @@ void ReplicatedPG::execute_ctx(OpContext *ctx)
     p->second->ondisk_read_lock();
   }
 
+  {
+    osd_reqid_t reqid = ctx->op->get_reqid();
+    tracepoint(osd, prepare_tx_enter, reqid.name._type,
+        reqid.name._num, reqid.tid, reqid.inc);
+  }
+
   int result = prepare_transaction(ctx);
 
+  {
+    osd_reqid_t reqid = ctx->op->get_reqid();
+    tracepoint(osd, prepare_tx_exit, reqid.name._type,
+        reqid.name._num, reqid.tid, reqid.inc);
+  }
+
   if (op->may_read()) {
     dout(10) << " dropping ondisk_read_lock" << dendl;
     obc->ondisk_read_unlock();
index f759a6a46e99d5a7b0f02c9bb705e11f6854b148..afdffe0b0360cec3c85717c7541625a38f826bbe 100644 (file)
@@ -1,6 +1,10 @@
 libtracepoints_la_SOURCES = \
        mutex.tp.c \
-       mutex.tp.h
+       mutex.tp.h \
+       osd.tp.c \
+       osd.tp.h \
+       pg.tp.h \
+       pg.tp.c
 
 libtracepoints_la_LIBADD = -llttng-ust -ldl
 libtracepoints_la_CPPFLAGS = -DTRACEPOINT_PROBE_DYNAMIC_LINKAGE
diff --git a/src/tracing/osd.tp b/src/tracing/osd.tp
new file mode 100644 (file)
index 0000000..fed1b1c
--- /dev/null
@@ -0,0 +1,74 @@
+TRACEPOINT_EVENT(osd, prepare_tx_enter,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
+
+TRACEPOINT_EVENT(osd, prepare_tx_exit,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
+
+TRACEPOINT_EVENT(osd, ms_fast_dispatch,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
+
+TRACEPOINT_EVENT(osd, opwq_process_start,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
+
+TRACEPOINT_EVENT(osd, opwq_process_finish,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
diff --git a/src/tracing/osd.tp.c b/src/tracing/osd.tp.c
new file mode 100644 (file)
index 0000000..c044c81
--- /dev/null
@@ -0,0 +1,7 @@
+
+#define TRACEPOINT_CREATE_PROBES
+/*
+ * The header containing our TRACEPOINT_EVENTs.
+ */
+#define TRACEPOINT_DEFINE
+#include "osd.tp.h"
diff --git a/src/tracing/osd.tp.h b/src/tracing/osd.tp.h
new file mode 100644 (file)
index 0000000..14caa87
--- /dev/null
@@ -0,0 +1,90 @@
+
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER osd
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./osd.tp.h"
+
+#if !defined(OSD_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define OSD_TP_H
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(osd, prepare_tx_enter,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
+
+TRACEPOINT_EVENT(osd, prepare_tx_exit,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
+
+TRACEPOINT_EVENT(osd, ms_fast_dispatch,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
+
+TRACEPOINT_EVENT(osd, opwq_process_start,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
+
+TRACEPOINT_EVENT(osd, opwq_process_finish,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
+
+#endif /* OSD_TP_H */
+
+#include <lttng/tracepoint-event.h>
diff --git a/src/tracing/pg.tp b/src/tracing/pg.tp
new file mode 100644 (file)
index 0000000..01476ab
--- /dev/null
@@ -0,0 +1,14 @@
+TRACEPOINT_EVENT(pg, queue_op,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
diff --git a/src/tracing/pg.tp.c b/src/tracing/pg.tp.c
new file mode 100644 (file)
index 0000000..4e63254
--- /dev/null
@@ -0,0 +1,7 @@
+
+#define TRACEPOINT_CREATE_PROBES
+/*
+ * The header containing our TRACEPOINT_EVENTs.
+ */
+#define TRACEPOINT_DEFINE
+#include "pg.tp.h"
diff --git a/src/tracing/pg.tp.h b/src/tracing/pg.tp.h
new file mode 100644 (file)
index 0000000..fa6b2f1
--- /dev/null
@@ -0,0 +1,30 @@
+
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER pg
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./pg.tp.h"
+
+#if !defined(PG_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define PG_TP_H
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(pg, queue_op,
+    TP_ARGS(
+        // osd_reqid_t
+        uint8_t,  type,
+        int64_t,  num,
+        uint64_t, tid,
+        int32_t,  inc),
+    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)
+    )
+)
+
+#endif /* PG_TP_H */
+
+#include <lttng/tracepoint-event.h>