diff --git a/configure.ac b/configure.ac index a777bf031e6c9..c0310ebd9a7a9 100644 --- a/configure.ac +++ b/configure.ac @@ -802,6 +802,13 @@ AC_CHECK_TYPES([__u8, __s8, __u16, __s16, __u32, __s32, __u64, __s64, __le16, AC_CHECK_HEADER([lttng/tracepoint.h], [], AC_MSG_ERROR([lttng/tracepoint.h not found (liblttng-ust-dev)])) +AC_CHECK_PROG([LTTNG_GEN_TP_CHECK], [lttng-gen-tp], [yes]) +if test x"$LTTNG_GEN_TP_CHECK" != "xyes"; then + AC_MSG_FAILURE([lttng-gen-tp not found]) +fi +AC_SUBST([LTTNG_GEN_TP_PROG], [lttng-gen-tp]) + + # Checks for typedefs, structures, and compiler characteristics. #AC_HEADER_STDBOOL #AC_C_CONST diff --git a/src/common/Mutex.cc b/src/common/Mutex.cc index 0a407f9fd2dc5..5c953bbaff9e1 100644 --- a/src/common/Mutex.cc +++ b/src/common/Mutex.cc @@ -19,7 +19,7 @@ #include "common/config.h" #include "include/utime.h" #include "common/Clock.h" -#include "tracing/mutex.tp.h" +#include "tracing/mutex.h" Mutex::Mutex(const char *n, bool r, bool ld, bool bt, diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index e48443d51735c..53b9b7ca4fbd4 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -132,7 +132,7 @@ #include "include/assert.h" #include "common/config.h" -#include "tracing/osd.tp.h" +#include "tracing/osd.h" #define dout_subsys ceph_subsys_osd #undef dout_prefix diff --git a/src/osd/PG.cc b/src/osd/PG.cc index cd411ce9600be..a6bfa34ae6ba5 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -41,7 +41,7 @@ #include "messages/MOSDSubOp.h" #include "messages/MOSDSubOpReply.h" #include "common/BackTrace.h" -#include "tracing/pg.tp.h" +#include "tracing/pg.h" #include diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 1386344d9e791..cdc8e06617aaa 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -57,7 +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" +#include "tracing/osd.h" #define dout_subsys ceph_subsys_osd #define DOUT_PREFIX_ARGS this, osd->whoami, get_osdmap() diff --git a/src/tracing/.gitignore b/src/tracing/.gitignore new file mode 100644 index 0000000000000..4bcc583049e1e --- /dev/null +++ b/src/tracing/.gitignore @@ -0,0 +1,2 @@ +*.h +*.c diff --git a/src/tracing/Makefile.am b/src/tracing/Makefile.am index afdffe0b0360c..b44ebd5349550 100644 --- a/src/tracing/Makefile.am +++ b/src/tracing/Makefile.am @@ -1,12 +1,22 @@ +%.c %.h: %.tp + $(LTTNG_GEN_TP_PROG) $< + rm -f $<.o + +dist_noinst_DATA = mutex.tp osd.tp pg.tp + libtracepoints_la_SOURCES = \ - mutex.tp.c \ - mutex.tp.h \ - osd.tp.c \ - osd.tp.h \ - pg.tp.h \ - pg.tp.c + mutex.c \ + mutex.h \ + osd.c \ + osd.h \ + pg.h \ + pg.c libtracepoints_la_LIBADD = -llttng-ust -ldl libtracepoints_la_CPPFLAGS = -DTRACEPOINT_PROBE_DYNAMIC_LINKAGE libtracepoints_la_LDFLAGS = noinst_LTLIBRARIES = libtracepoints.la + +BUILT_SOURCES = mutex.h osd.h pg.h + +CLEANFILES = $(libtracepoints_la_SOURCES) diff --git a/src/tracing/README.md b/src/tracing/README.md index 1c86eb3b04ba5..a72f33e9e09df 100644 --- a/src/tracing/README.md +++ b/src/tracing/README.md @@ -1,32 +1,24 @@ -Add New Provider -================ - -## Create tracepoint definition file - -Add tracepoint definitions for the provider into a `.tp` file. Documentation -on defining a tracepoint can be found in `man lttng-ust`. By convention files -are named according to the logical sub-system they correspond to (e.g. -`mutex.tp`, `pg.tp`). +Installation +============ -## Generate tracepoint source files +The LTTng libraries that ship with Ubuntu 12.04 have been very buggy, and the +generated header files using `lttng-gen-tp` have needed to be fixed just to +compile in the Ceph tree. The packages available in Ubuntu 14.04 seem to work +alright, and for older versions please install LTTng from the LTTng PPA. -The `.tp` file is converted into source files using the `lttng-gen-tp` tool. + https://launchpad.net/~lttng/+archive/ppa - lttng-gen-tp mutex.tp -o mutex.tp.h -o mutex.tp.c +Then install as normal -## Add source files to libtracepoints.la + apt-get install lttng-tools liblttng-ust-dev -Modify Makefile.am to include the generated source files from the previous -step. - -## Commit changes to Git - -Commit both the source `.tp` file as well as the generated sources, and the -changes to Makefile.am. +Add/Update Provider +================ -Add Tracepoint to Existing Provider -=================================== +## Create tracepoint definition file -New tracepoints can be added to an existing provider by updating the -corresponding `.tp` file and re-generating the source files. Make sure to -commit the updated files back into Git. +Add tracepoint definitions for the provider into a `.tp` file. Documentation +on defining a tracepoint can be found in `man lttng-ust`. By convention files +are named according to the logical sub-system they correspond to (e.g. +`mutex.tp`, `pg.tp`). Place the `.tp` file into the `src/tracing` directory +and modify the automake file `src/tracing/Makefile.am` accordingly. diff --git a/src/tracing/mutex.tp.c b/src/tracing/mutex.tp.c deleted file mode 100644 index 1727e8089c76c..0000000000000 --- a/src/tracing/mutex.tp.c +++ /dev/null @@ -1,7 +0,0 @@ - -#define TRACEPOINT_CREATE_PROBES -/* - * The header containing our TRACEPOINT_EVENTs. - */ -#define TRACEPOINT_DEFINE -#include "mutex.tp.h" diff --git a/src/tracing/mutex.tp.h b/src/tracing/mutex.tp.h deleted file mode 100644 index e26e86d1f588b..0000000000000 --- a/src/tracing/mutex.tp.h +++ /dev/null @@ -1,45 +0,0 @@ - -#undef TRACEPOINT_PROVIDER -#define TRACEPOINT_PROVIDER mutex - -#undef TRACEPOINT_INCLUDE -#define TRACEPOINT_INCLUDE "./mutex.tp.h" - -#if !defined(MUTEX_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ) -#define MUTEX_TP_H - -#include - -TRACEPOINT_EVENT(mutex, lock_enter, - TP_ARGS( - const void *, addr, - const char *, name), - TP_FIELDS( - ctf_integer_hex(unsigned long, addr, addr) - ctf_string(name, name) - ) -) - -TRACEPOINT_EVENT(mutex, lock_exit, - TP_ARGS( - const void *, addr, - const char *, name), - TP_FIELDS( - ctf_integer_hex(unsigned long, addr, addr) - ctf_string(name, name) - ) -) - -TRACEPOINT_EVENT(mutex, unlock, - TP_ARGS( - const void *, addr, - const char *, name), - TP_FIELDS( - ctf_integer_hex(unsigned long, addr, addr) - ctf_string(name, name) - ) -) - -#endif /* MUTEX_TP_H */ - -#include diff --git a/src/tracing/osd.tp.c b/src/tracing/osd.tp.c deleted file mode 100644 index c044c81934c34..0000000000000 --- a/src/tracing/osd.tp.c +++ /dev/null @@ -1,7 +0,0 @@ - -#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 deleted file mode 100644 index 14caa8732d37e..0000000000000 --- a/src/tracing/osd.tp.h +++ /dev/null @@ -1,90 +0,0 @@ - -#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.c b/src/tracing/pg.tp.c deleted file mode 100644 index 4e63254ad3854..0000000000000 --- a/src/tracing/pg.tp.c +++ /dev/null @@ -1,7 +0,0 @@ - -#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 deleted file mode 100644 index fa6b2f1785ad5..0000000000000 --- a/src/tracing/pg.tp.h +++ /dev/null @@ -1,30 +0,0 @@ - -#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