[tor-commits] [tor/master] trace: Only build probes if instrumentation is enabled

nickm at torproject.org nickm at torproject.org
Fri Jul 10 17:05:59 UTC 2020


commit 24a5983d84a99dc10c0b8fe961af03135960085b
Author: David Goulet <dgoulet at torproject.org>
Date:   Thu Feb 13 10:44:00 2020 -0500

    trace: Only build probes if instrumentation is enabled
    
    For now, trace_probes_circuit.c only contains LTTng probes so build it only if
    enabled within in the build system _and_ the code.
    
    Also, ignore trace_probes_circuit.h for coccinelle parsing.
    
    Signed-off-by: David Goulet <dgoulet at torproject.org>
---
 src/core/or/include.am             | 9 +++++++--
 src/core/or/trace_probes_circuit.h | 7 ++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/core/or/include.am b/src/core/or/include.am
index 819b8ab60..9ff92adbd 100644
--- a/src/core/or/include.am
+++ b/src/core/or/include.am
@@ -34,7 +34,6 @@ LIBTOR_APP_A_SOURCES += 				\
 	src/core/or/scheduler_vanilla.c		\
 	src/core/or/sendme.c			\
 	src/core/or/status.c			\
-	src/core/or/trace_probes_circuit.c	\
 	src/core/or/versions.c
 
 # ADD_C_FILE: INSERT HEADERS HERE.
@@ -95,6 +94,12 @@ noinst_HEADERS +=					\
 	src/core/or/socks_request_st.h			\
 	src/core/or/status.h				\
 	src/core/or/tor_version_st.h			\
-	src/core/or/trace_probes_circuit.h		\
 	src/core/or/var_cell_st.h			\
 	src/core/or/versions.h
+
+if USE_TRACING_INSTRUMENTATION_LTTNG
+LIBTOR_APP_A_SOURCES += \
+	src/core/or/trace_probes_circuit.c
+noinst_HEADERS += \
+	src/core/or/trace_probes_circuit.h
+endif
diff --git a/src/core/or/trace_probes_circuit.h b/src/core/or/trace_probes_circuit.h
index 44842efb0..a85ed089a 100644
--- a/src/core/or/trace_probes_circuit.h
+++ b/src/core/or/trace_probes_circuit.h
@@ -7,6 +7,8 @@
  *        LTTng-UST probes are available.
  **/
 
+#ifndef COCCI
+
 #include "orconfig.h"
 
 /* We only build the following if LTTng instrumentation has been enabled. */
@@ -19,7 +21,8 @@
 #undef TRACEPOINT_INCLUDE
 #define TRACEPOINT_INCLUDE "./src/core/or/trace_probes_circuit.h"
 
-#if !defined(TOR_TRACE_PROBES_CIRCUIT_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#if !defined(TOR_TRACE_PROBES_CIRCUIT_H) || \
+    defined(TRACEPOINT_HEADER_MULTI_READ)
 #define TOR_TRACE_PROBES_CIRCUIT_H
 
 #include <lttng/tracepoint.h>
@@ -319,3 +322,5 @@ TRACEPOINT_EVENT(tor_circuit, change_state,
 #include <lttng/tracepoint-event.h>
 
 #endif /* USE_TRACING_INSTRUMENTATION_LTTNG */
+
+#endif /* COCCI */





More information about the tor-commits mailing list