// -*- 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>
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);
+}
}
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 {
}
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;
$(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 \
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)
--- /dev/null
+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)
+ )
+)