From: Noah Watkins Date: Sat, 7 Jun 2014 16:37:39 +0000 (-0700) Subject: lttng: add pg and osd tracepoints X-Git-Tag: v0.86~231^2~78 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3ac99e3f72a758cd2b0af5fe0316f35c5c03fbe1;p=ceph.git lttng: add pg and osd tracepoints Signed-off-by: Noah Watkins --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a1ac5e912086..e48443d51735 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -132,6 +132,7 @@ #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(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(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 item) { diff --git a/src/osd/OpRequest.cc b/src/osd/OpRequest.cc index a6ee3ee5dfcf..7cb077291a83 100644 --- a/src/osd/OpRequest.cc +++ b/src/osd/OpRequest.cc @@ -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), diff --git a/src/osd/PG.cc b/src/osd/PG.cc index dc10b797cd30..cd411ce9600b 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -41,6 +41,7 @@ #include "messages/MOSDSubOp.h" #include "messages/MOSDSubOpReply.h" #include "common/BackTrace.h" +#include "tracing/pg.tp.h" #include @@ -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() diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 19de29b02547..1386344d9e79 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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(); diff --git a/src/tracing/Makefile.am b/src/tracing/Makefile.am index f759a6a46e99..afdffe0b0360 100644 --- a/src/tracing/Makefile.am +++ b/src/tracing/Makefile.am @@ -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 index 000000000000..fed1b1c5f754 --- /dev/null +++ b/src/tracing/osd.tp @@ -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 index 000000000000..c044c81934c3 --- /dev/null +++ b/src/tracing/osd.tp.c @@ -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 index 000000000000..14caa8732d37 --- /dev/null +++ b/src/tracing/osd.tp.h @@ -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 + +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 diff --git a/src/tracing/pg.tp b/src/tracing/pg.tp new file mode 100644 index 000000000000..01476ab5d753 --- /dev/null +++ b/src/tracing/pg.tp @@ -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 index 000000000000..4e63254ad385 --- /dev/null +++ b/src/tracing/pg.tp.c @@ -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 index 000000000000..fa6b2f1785ad --- /dev/null +++ b/src/tracing/pg.tp.h @@ -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 + +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