mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 13:53:31 +01:00
trace: Add LTTng-UST interface support
No probes at this point. They are per subsystem and thus in later commits. Part of #32910
This commit is contained in:
parent
668fc70a20
commit
0de543aae6
29
configure.ac
29
configure.ac
@ -258,6 +258,24 @@ AC_ARG_ENABLE(libscrypt,
|
||||
|
||||
dnl --- Tracing Options. ---
|
||||
|
||||
TOR_TRACE_LIBS=
|
||||
|
||||
dnl LTTng instrumentation option.
|
||||
AC_ARG_ENABLE(tracing-instrumentation-lttng,
|
||||
AS_HELP_STRING([--enable-tracing-instrumentation-lttng],
|
||||
[build with LTTng-UST instrumentation]))
|
||||
AM_CONDITIONAL([USE_TRACING_INSTRUMENTATION_LTTNG],
|
||||
[test "x$enable_tracing_instrumentation_lttng" = "xyes"])
|
||||
|
||||
if test "x$enable_tracing_instrumentation_lttng" = "xyes"; then
|
||||
AC_CHECK_HEADERS([lttng/tracepoint.h], [],
|
||||
[AC_MSG_ERROR([LTTng instrumentation headers not found.
|
||||
On Debian, apt install liblttng-ust-dev"])], [])
|
||||
AC_DEFINE([USE_TRACING_INSTRUMENTATION_LTTNG], [1], [Using LTTng instrumentation])
|
||||
TOR_TRACE_LIBS="-llttng-ust -ldl"
|
||||
fi
|
||||
|
||||
|
||||
dnl USDT instrumentation option.
|
||||
AC_ARG_ENABLE(tracing-instrumentation-usdt,
|
||||
AS_HELP_STRING([--enable-tracing-instrumentation-usdt],
|
||||
@ -269,6 +287,9 @@ if test "x$enable_tracing_instrumentation_usdt" = "xyes"; then
|
||||
AC_CHECK_HEADERS([sys/sdt.h], [],
|
||||
[AC_MSG_ERROR([USDT instrumentation requires sys/sdt.h header.
|
||||
On Debian, apt install systemtap-sdt-dev])], [])
|
||||
dnl LTTng generates USDT probes if the UST library was built with
|
||||
dnl --with-sdt. There is unfortunately no way to check that so we always
|
||||
dnl build the USDT probes even though LTTng instrumentation was requested.
|
||||
AC_DEFINE([USE_TRACING_INSTRUMENTATION_USDT], [1], [Using USDT instrumentation])
|
||||
fi
|
||||
|
||||
@ -286,6 +307,11 @@ AM_COND_IF([USE_TRACING_INSTRUMENTATION_LOG_DEBUG],
|
||||
AC_DEFINE([HAVE_TRACING], [1], [Compiled with tracing support]))
|
||||
AM_COND_IF([USE_TRACING_INSTRUMENTATION_USDT],
|
||||
AC_DEFINE([HAVE_TRACING], [1], [Compiled with tracing support]))
|
||||
AM_COND_IF([USE_TRACING_INSTRUMENTATION_LTTNG],
|
||||
AC_DEFINE([HAVE_TRACING], [1], [Compiled with tracing support]))
|
||||
|
||||
dnl Finally, define the trace libs.
|
||||
AC_SUBST([TOR_TRACE_LIBS])
|
||||
|
||||
dnl -- End Tracing Options. --
|
||||
|
||||
@ -2750,6 +2776,9 @@ PPRINT_PROP_BOOL([Tracepoints to log_debug() (--enable-tracing-instrumentation-l
|
||||
test "x$enable_tracing_instrumentation_usdt" = "xyes" && value=1 || value=0
|
||||
PPRINT_PROP_BOOL([USDT Instrumentation (--enable-tracing-instrumentation-usdt)], $value)
|
||||
|
||||
test "x$enable_tracing_instrumentation_lttng" = "xyes" && value=1 || value=0
|
||||
PPRINT_PROP_BOOL([LTTng Instrumentation (--enable-tracing-instrumentation-lttng)], $value)
|
||||
|
||||
AS_ECHO
|
||||
PPRINT_SUBTITLE([Install Directories])
|
||||
|
||||
|
@ -20,7 +20,7 @@ src_app_tor_LDADD = $(TOR_INTERNAL_LIBS) \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) \
|
||||
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ \
|
||||
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
|
||||
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@ @TOR_TRACE_LIBS@
|
||||
|
||||
if COVERAGE_ENABLED
|
||||
src_app_tor_cov_SOURCES = $(src_app_tor_SOURCES)
|
||||
@ -31,5 +31,5 @@ src_app_tor_cov_LDADD = $(TOR_INTERNAL_TESTING_LIBS) \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) \
|
||||
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ \
|
||||
@CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ \
|
||||
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
|
||||
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@ @TOR_TRACE_LIBS@
|
||||
endif
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
3
src/lib/trace/lttng/include.am
Normal file
3
src/lib/trace/lttng/include.am
Normal file
@ -0,0 +1,3 @@
|
||||
# ADD_C_FILE: INSERT HEADERS HERE.
|
||||
TRACEHEADERS += \
|
||||
src/lib/trace/lttng/lttng.h
|
28
src/lib/trace/lttng/lttng.h
Normal file
28
src/lib/trace/lttng/lttng.h
Normal file
@ -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 */
|
||||
|
@ -14,7 +14,7 @@ FUZZING_LIBS = \
|
||||
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ @CURVE25519_LIBS@ \
|
||||
@TOR_SYSTEMD_LIBS@ \
|
||||
@TOR_LZMA_LIBS@ \
|
||||
@TOR_ZSTD_LIBS@
|
||||
@TOR_ZSTD_LIBS@ @TOR_TRACE_LIBS@
|
||||
|
||||
oss-fuzz-prereqs: \
|
||||
$(TOR_INTERNAL_TESTING_LIBS)
|
||||
|
@ -297,7 +297,7 @@ src_test_test_switch_id_LDADD = \
|
||||
$(rust_ldadd) \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
|
||||
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_USERENV@ \
|
||||
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
|
||||
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@ @TOR_TRACE_LIBS@
|
||||
|
||||
src_test_test_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) \
|
||||
@TOR_LDFLAGS_libevent@
|
||||
@ -307,7 +307,7 @@ src_test_test_LDADD = \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@CURVE25519_LIBS@ \
|
||||
@TOR_SYSTEMD_LIBS@ @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
|
||||
@TOR_SYSTEMD_LIBS@ @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@ @TOR_TRACE_LIBS@
|
||||
|
||||
src_test_test_slow_CPPFLAGS = $(src_test_test_CPPFLAGS)
|
||||
src_test_test_slow_CFLAGS = $(src_test_test_CFLAGS)
|
||||
@ -336,7 +336,7 @@ src_test_bench_LDADD = \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@CURVE25519_LIBS@ \
|
||||
@TOR_SYSTEMD_LIBS@ @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
|
||||
@TOR_SYSTEMD_LIBS@ @TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@ @TOR_TRACE_LIBS@
|
||||
|
||||
src_test_test_workqueue_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) \
|
||||
@TOR_LDFLAGS_libevent@
|
||||
@ -346,7 +346,7 @@ src_test_test_workqueue_LDADD = \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@CURVE25519_LIBS@ \
|
||||
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@
|
||||
@TOR_LZMA_LIBS@ @TOR_ZSTD_LIBS@ @TOR_TRACE_LIBS@
|
||||
|
||||
src_test_test_timers_CPPFLAGS = $(src_test_test_CPPFLAGS)
|
||||
src_test_test_timers_CFLAGS = $(src_test_test_CFLAGS)
|
||||
@ -358,7 +358,7 @@ src_test_test_timers_LDADD = \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@CURVE25519_LIBS@ \
|
||||
@TOR_LZMA_LIBS@
|
||||
@TOR_LZMA_LIBS@ @TOR_TRACE_LIBS@
|
||||
src_test_test_timers_LDFLAGS = $(src_test_test_LDFLAGS)
|
||||
|
||||
# ADD_C_FILE: INSERT HEADERS HERE.
|
||||
@ -394,7 +394,7 @@ src_test_test_ntor_cl_LDADD = \
|
||||
$(rust_ldadd) \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@CURVE25519_LIBS@ @TOR_LZMA_LIBS@
|
||||
@CURVE25519_LIBS@ @TOR_LZMA_LIBS@ @TOR_TRACE_LIBS@
|
||||
src_test_test_ntor_cl_AM_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS)
|
||||
|
||||
@ -403,7 +403,8 @@ src_test_test_hs_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB)
|
||||
src_test_test_hs_ntor_cl_LDADD = \
|
||||
$(TOR_INTERNAL_LIBS) \
|
||||
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @CURVE25519_LIBS@
|
||||
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ \
|
||||
@CURVE25519_LIBS@ @TOR_TRACE_LIBS@
|
||||
src_test_test_hs_ntor_cl_AM_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS)
|
||||
|
||||
@ -415,7 +416,8 @@ src_test_test_bt_cl_LDADD = \
|
||||
$(TOR_UTIL_TESTING_LIBS) \
|
||||
$(rust_ldadd) \
|
||||
@TOR_LIB_MATH@ \
|
||||
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@
|
||||
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
|
||||
@TOR_TRACE_LIBS@
|
||||
src_test_test_bt_cl_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
|
||||
src_test_test_bt_cl_CPPFLAGS= $(src_test_AM_CPPFLAGS) $(TEST_CPPFLAGS)
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user