From: Michael Jeanson Date: Wed, 3 Mar 2021 22:32:55 +0000 (-0500) Subject: Move perf counter symbols to private header X-Git-Tag: v2.13.0-rc1~346 X-Git-Url: http://git.liburcu.org/?p=lttng-ust.git;a=commitdiff_plain;h=bd8c1787628a2703b49c239b0e46613ac6b41131 Move perf counter symbols to private header This is an API change but the major SONAME bump to '1' gives us the opportunity to hide symbols that should have been private from the start. This also allows to stop exposing LTTNG_UST_HAVE_PERF_EVENT in the public headers. Change-Id: I43893b7bad6d447e86af33ad99def6c76689123f Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/configure.ac b/configure.ac index 3c92b407..0bd11f36 100644 --- a/configure.ac +++ b/configure.ac @@ -217,7 +217,6 @@ AS_CASE([$host_os], # Configuration options, which will be installed in the config.h AH_TEMPLATE([LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS], [Use efficient unaligned access.]) AH_TEMPLATE([LTTNG_UST_HAVE_SDT_INTEGRATION], [SystemTap integration via sdt.h]) -AH_TEMPLATE([LTTNG_UST_HAVE_PERF_EVENT], [Perf event integration via perf_event.h]) # Checks for libraries. AC_CHECK_LIB([dl], [dlopen], [ @@ -283,8 +282,9 @@ AC_CHECK_HEADERS([linux/perf_event.h], [have_perf_event=yes], []) # perf, using the read system call as fallback. AM_CONDITIONAL([HAVE_PERF_EVENT], [test "x$have_perf_event" = "xyes"]) +AH_TEMPLATE([HAVE_PERF_EVENT], ["Perf event integration via perf_event.h"]) AS_IF([test "x$have_perf_event" = "xyes"], [ - AC_DEFINE([LTTNG_UST_HAVE_PERF_EVENT], [1]) + AC_DEFINE([HAVE_PERF_EVENT], [1]) ]) AS_IF([test "x$NO_UNALIGNED_ACCESS" = "x"], [ diff --git a/include/lttng/ust-config.h.in b/include/lttng/ust-config.h.in index 632131c7..92cdf2dd 100644 --- a/include/lttng/ust-config.h.in +++ b/include/lttng/ust-config.h.in @@ -9,6 +9,3 @@ /* DTrace/GDB/SystemTap integration via sdt.h */ #undef LTTNG_UST_HAVE_SDT_INTEGRATION - -/* Perf event integration via perf_event.h */ -#undef LTTNG_UST_HAVE_PERF_EVENT diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index a2d6a585..01617574 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -778,32 +777,6 @@ void lttng_context_vgid_reset(void); void lttng_context_vegid_reset(void); void lttng_context_vsgid_reset(void); -#ifdef LTTNG_UST_HAVE_PERF_EVENT -int lttng_add_perf_counter_to_ctx(uint32_t type, - uint64_t config, - const char *name, - struct lttng_ctx **ctx); -int lttng_perf_counter_init(void); -void lttng_perf_counter_exit(void); -#else /* #ifdef LTTNG_UST_HAVE_PERF_EVENT */ -static inline -int lttng_add_perf_counter_to_ctx(uint32_t type, - uint64_t config, - const char *name, - struct lttng_ctx **ctx) -{ - return -ENOSYS; -} -static inline -int lttng_perf_counter_init(void) -{ - return 0; -} -static inline -void lttng_perf_counter_exit(void) -{ -} -#endif /* #else #ifdef LTTNG_UST_HAVE_PERF_EVENT */ extern const struct lttng_ust_client_lib_ring_buffer_client_cb *lttng_client_callbacks_metadata; extern const struct lttng_ust_client_lib_ring_buffer_client_cb *lttng_client_callbacks_discard; diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index a149e9d6..e31f8392 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -1998,7 +1998,7 @@ int ustctl_get_instance_id(struct ustctl_consumer_stream *stream, return client_cb->instance_id(buf, handle, id); } -#ifdef LTTNG_UST_HAVE_PERF_EVENT +#ifdef HAVE_PERF_EVENT int ustctl_has_perf_counters(void) { diff --git a/liblttng-ust/lttng-context-perf-counters.c b/liblttng-ust/lttng-context-perf-counters.c index c7dc2ecb..738a1d52 100644 --- a/liblttng-ust/lttng-context-perf-counters.c +++ b/liblttng-ust/lttng-context-perf-counters.c @@ -30,6 +30,7 @@ #include #include "perf_event.h" #include "lttng-tracer-core.h" +#include "ust-events-internal.h" /* * We use a global perf counter key and iterate on per-thread RCU lists diff --git a/liblttng-ust/lttng-tracer-core.h b/liblttng-ust/lttng-tracer-core.h index 9042a303..392325f3 100644 --- a/liblttng-ust/lttng-tracer-core.h +++ b/liblttng-ust/lttng-tracer-core.h @@ -86,11 +86,11 @@ void lttng_counter_transport_register(struct lttng_counter_transport *transport) LTTNG_HIDDEN void lttng_counter_transport_unregister(struct lttng_counter_transport *transport); -#ifdef LTTNG_UST_HAVE_PERF_EVENT +#ifdef HAVE_PERF_EVENT void lttng_ust_fixup_perf_counter_tls(void); void lttng_perf_lock(void); void lttng_perf_unlock(void); -#else /* #ifdef LTTNG_UST_HAVE_PERF_EVENT */ +#else /* #ifdef HAVE_PERF_EVENT */ static inline void lttng_ust_fixup_perf_counter_tls(void) { @@ -103,6 +103,6 @@ static inline void lttng_perf_unlock(void) { } -#endif /* #else #ifdef LTTNG_UST_HAVE_PERF_EVENT */ +#endif /* #else #ifdef HAVE_PERF_EVENT */ #endif /* _LTTNG_TRACER_CORE_H */ diff --git a/liblttng-ust/ust-events-internal.h b/liblttng-ust/ust-events-internal.h index bd30e00a..e46a8b7c 100644 --- a/liblttng-ust/ust-events-internal.h +++ b/liblttng-ust/ust-events-internal.h @@ -242,4 +242,37 @@ struct lttng_counter *lttng_ust_counter_create( const char *counter_transport_name, size_t number_dimensions, const struct lttng_counter_dimension *dimensions); +#ifdef HAVE_PERF_EVENT + +LTTNG_HIDDEN +int lttng_add_perf_counter_to_ctx(uint32_t type, + uint64_t config, + const char *name, + struct lttng_ctx **ctx); +LTTNG_HIDDEN +int lttng_perf_counter_init(void); +LTTNG_HIDDEN +void lttng_perf_counter_exit(void); + +#else /* #ifdef HAVE_PERF_EVENT */ + +static inline +int lttng_add_perf_counter_to_ctx(uint32_t type, + uint64_t config, + const char *name, + struct lttng_ctx **ctx) +{ + return -ENOSYS; +} +static inline +int lttng_perf_counter_init(void) +{ + return 0; +} +static inline +void lttng_perf_counter_exit(void) +{ +} +#endif /* #else #ifdef HAVE_PERF_EVENT */ + #endif /* _LTTNG_UST_EVENTS_INTERNAL_H */