]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tracing: automake-ify tracepoint generation
authorNoah Watkins <noahwatkins@gmail.com>
Fri, 20 Jun 2014 23:49:28 +0000 (16:49 -0700)
committerAdam Crume <adamcrume@gmail.com>
Wed, 13 Aug 2014 20:58:13 +0000 (13:58 -0700)
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
14 files changed:
configure.ac
src/common/Mutex.cc
src/osd/OSD.cc
src/osd/PG.cc
src/osd/ReplicatedPG.cc
src/tracing/.gitignore [new file with mode: 0644]
src/tracing/Makefile.am
src/tracing/README.md
src/tracing/mutex.tp.c [deleted file]
src/tracing/mutex.tp.h [deleted file]
src/tracing/osd.tp.c [deleted file]
src/tracing/osd.tp.h [deleted file]
src/tracing/pg.tp.c [deleted file]
src/tracing/pg.tp.h [deleted file]

index 8a91382defbd0aff6a2e2cc38bbce549606fefda..6193365e53b950e8083bdffe9b610b4d10536374 100644 (file)
@@ -763,6 +763,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
index 0a407f9fd2dc5543cceaa0701fb2d0102705c9ee..5c953bbaff9e194bc860cde8d89335a0157c9c5e 100644 (file)
@@ -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,
index 2f5fe6b110ba46d33c9154d5b9ac1238f99bf161..ecc43be1a206186905638b32697d7ee712b27748 100644 (file)
 
 #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
index 843c1380080bdb3f12f9e9b1dbf604f468825866..b571a0db25898fe41109449eb025fd12deed7de3 100644 (file)
@@ -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 <sstream>
 
index 36073ca5bc10d85b73ada3c7a0193ee55518ffbf..a1fc2dd2cc580d4f972428102701f99333382145 100644 (file)
@@ -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 (file)
index 0000000..4bcc583
--- /dev/null
@@ -0,0 +1,2 @@
+*.h
+*.c
index afdffe0b0360cec3c85717c7541625a38f826bbe..b44ebd5349550fa3c932f13df21c7578587a11df 100644 (file)
@@ -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)
index 1c86eb3b04ba54b17076661464984f3f8d08d1c6..a72f33e9e09df113d7edb495109c8a807f595def 100644 (file)
@@ -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 (file)
index 1727e80..0000000
+++ /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 (file)
index e26e86d..0000000
+++ /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 <lttng/tracepoint.h>
-
-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 <lttng/tracepoint-event.h>
diff --git a/src/tracing/osd.tp.c b/src/tracing/osd.tp.c
deleted file mode 100644 (file)
index c044c81..0000000
+++ /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 (file)
index 14caa87..0000000
+++ /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 <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.c b/src/tracing/pg.tp.c
deleted file mode 100644 (file)
index 4e63254..0000000
+++ /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 (file)
index fa6b2f1..0000000
+++ /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 <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>