summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-02-11 11:26:04 -0500
committerDavid Goulet <dgoulet@torproject.org>2020-07-08 09:10:08 -0400
commit0de543aae636e422bc9fa339efa81e8260b77ae4 (patch)
tree8168f28c340b36fb571b28ff00505fba00ed7781 /src/lib
parent668fc70a20c602bb0e74bf0e19589a17bb45b7ae (diff)
downloadtor-0de543aae636e422bc9fa339efa81e8260b77ae4.tar.gz
tor-0de543aae636e422bc9fa339efa81e8260b77ae4.zip
trace: Add LTTng-UST interface support
No probes at this point. They are per subsystem and thus in later commits. Part of #32910
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/trace/events.h5
-rw-r--r--src/lib/trace/include.am4
-rw-r--r--src/lib/trace/lttng/include.am3
-rw-r--r--src/lib/trace/lttng/lttng.h28
4 files changed, 40 insertions, 0 deletions
diff --git a/src/lib/trace/events.h b/src/lib/trace/events.h
index fcd31e24e1..8cc0136b09 100644
--- a/src/lib/trace/events.h
+++ b/src/lib/trace/events.h
@@ -17,6 +17,7 @@
do { \
TOR_TRACE_LOG_DEBUG(tor_ ## subsystem, event_name); \
TOR_TRACE_USDT(tor_ ## subsystem, event_name, ## __VA_ARGS__); \
+ TOR_TRACE_LTTNG(tor_ ## subsystem, event_name, ## __VA_ARGS__); \
} while (0)
/* This corresponds to the --enable-tracing-instrumentation-log-debug
@@ -27,6 +28,10 @@
* option which will generate USDT probes for each tracepoints. */
#include "lib/trace/usdt/usdt.h"
+/* This corresponds to the --enable-tracing-instrumentation-lttng configure
+ * option which will generate LTTng probes for each tracepoints. */
+#include "lib/trace/lttng/lttng.h"
+
#else /* !defined(HAVE_TRACING) */
/* Reaching this point, tracing is disabled thus we NOP every tracepoints
diff --git a/src/lib/trace/include.am b/src/lib/trace/include.am
index 01ea0c8a1d..8440331325 100644
--- a/src/lib/trace/include.am
+++ b/src/lib/trace/include.am
@@ -22,6 +22,10 @@ if USE_TRACING_INSTRUMENTATION_USDT
include src/lib/trace/usdt/include.am
endif
+if USE_TRACING_INSTRUMENTATION_LTTNG
+include src/lib/trace/lttng/include.am
+endif
+
src_lib_libtor_trace_a_SOURCES = $(LIBTOR_TRACE_A_SOURCES)
noinst_HEADERS+= $(TRACEHEADERS)
diff --git a/src/lib/trace/lttng/include.am b/src/lib/trace/lttng/include.am
new file mode 100644
index 0000000000..4495ce0900
--- /dev/null
+++ b/src/lib/trace/lttng/include.am
@@ -0,0 +1,3 @@
+# ADD_C_FILE: INSERT HEADERS HERE.
+TRACEHEADERS += \
+ src/lib/trace/lttng/lttng.h
diff --git a/src/lib/trace/lttng/lttng.h b/src/lib/trace/lttng/lttng.h
new file mode 100644
index 0000000000..8ede98bb02
--- /dev/null
+++ b/src/lib/trace/lttng/lttng.h
@@ -0,0 +1,28 @@
+/* Copyright (c) 2020, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file lttng.h
+ * \brief Header file for lttng.c.
+ **/
+
+#ifndef TOR_TRACE_LTTNG_LTTNG_H
+#define TOR_TRACE_LTTNG_LTTNG_H
+
+#ifdef USE_TRACING_INSTRUMENTATION_LTTNG
+
+#include <lttng/tracepoint.h>
+
+/* Map event to an LTTng tracepoint. */
+#define TOR_TRACE_LTTNG(subsystem, event_name, ...) \
+ tracepoint(subsystem, event_name, ## __VA_ARGS__)
+
+#else /* !defined(USE_TRACING_INSTRUMENTATION_LTTNG) */
+
+/* NOP event. */
+#define TOR_TRACE_LTTNG(subsystem, event_name, ...)
+
+#endif /* !defined(USE_TRACING_INSTRUMENTATION_LTTNG) */
+
+#endif /* TOR_TRACE_LTTNG_LTTNG_H */
+