src/ocf/ceph
src/ocf/rbd
src/java/Makefile
+ src/tracing/Makefile
man/Makefile
ceph.spec])
AC_OUTPUT
LIBKRBD = libkrbd.la
LIBCEPHFS = libcephfs.la
LIBERASURE_CODE = liberasure_code.la
+LIBTRACEPOINTS = tracing/libtracepoints.la
if WITH_LIBAIO
LIBOS += -laio
include Makefile-env.am
-SUBDIRS += ocf java
-DIST_SUBDIRS += gtest ocf libs3 java
+SUBDIRS += ocf java tracing
+DIST_SUBDIRS += gtest ocf libs3 java tracing
LIBCOMMON_DEPS += \
$(LIBERASURE_CODE) \
$(LIBMSG) $(LIBAUTH) \
- $(LIBCRUSH) $(LIBJSON_SPIRIT) $(LIBLOG) $(LIBARCH)
+ $(LIBCRUSH) $(LIBJSON_SPIRIT) $(LIBLOG) $(LIBARCH) \
+ $(LIBTRACEPOINTS)
if LINUX
LIBCOMMON_DEPS += -lrt
#include "common/config.h"
#include "include/utime.h"
#include "common/Clock.h"
+#include "tracing/mutex.tp.h"
Mutex::Mutex(const char *n, bool r, bool ld,
bool bt,
}
void Mutex::Lock(bool no_lockdep) {
+ utime_t start;
+ int r;
+
+ tracepoint(mutex, lock_enter, this, name);
+
if (lockdep && g_lockdep && !no_lockdep) _will_lock();
if (TryLock()) {
- return;
+ goto out;
}
- utime_t start;
if (logger && cct && cct->_conf->mutex_perf_counter)
start = ceph_clock_now(cct);
- int r = pthread_mutex_lock(&_m);
+ r = pthread_mutex_lock(&_m);
if (logger && cct && cct->_conf->mutex_perf_counter)
logger->tinc(l_mutex_wait,
ceph_clock_now(cct) - start);
assert(r == 0);
if (lockdep && g_lockdep) _locked();
_post_lock();
+
+out:
+ tracepoint(mutex, lock_exit, this, name);
}
--- /dev/null
+libtracepoints_la_SOURCES = \
+ mutex.tp.c \
+ mutex.tp.h
+
+libtracepoints_la_LIBADD = -llttng-ust -ldl
+libtracepoints_la_CPPFLAGS = -DTRACEPOINT_DEFINE -DTRACEPOINT_PROBE_DYNAMIC_LINKAGE
+libtracepoints_la_LDFLAGS =
+noinst_LTLIBRARIES = libtracepoints.la
--- /dev/null
+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`).
+
+## Generate tracepoint source files
+
+The `.tp` file is converted into source files using the `lttng-gen-tp` tool.
+
+ lttng-gen-tp mutex.tp -o mutex.tp.h -o mutex.tp.c
+
+## Add source files to libtracepoints.la
+
+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 Tracepoint to Existing Provider
+===================================
+
+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.
--- /dev/null
+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)
+ )
+)
--- /dev/null
+
+#define TRACEPOINT_CREATE_PROBES
+/*
+ * The header containing our TRACEPOINT_EVENTs.
+ */
+#define TRACEPOINT_DEFINE
+#include "mutex.tp.h"
--- /dev/null
+
+#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)
+ )
+)
+
+#endif /* MUTEX_TP_H */
+
+#include <lttng/tracepoint-event.h>