diff --git a/rclcpp/include/rclcpp/any_service_callback.hpp b/rclcpp/include/rclcpp/any_service_callback.hpp index 294d2f2..c683345 100644 --- a/rclcpp/include/rclcpp/any_service_callback.hpp +++ b/rclcpp/include/rclcpp/any_service_callback.hpp @@ -102,6 +102,7 @@ public: void register_callback_for_tracing() { +#ifndef TRACETOOLS_DISABLED if (shared_ptr_callback_) { TRACEPOINT( rclcpp_callback_register, @@ -113,6 +114,7 @@ public: (const void *)this, get_symbol(shared_ptr_with_request_header_callback_)); } +#endif // TRACETOOLS_DISABLED } }; diff --git a/rclcpp/include/rclcpp/any_subscription_callback.hpp b/rclcpp/include/rclcpp/any_subscription_callback.hpp index f6b669f..1909b85 100644 --- a/rclcpp/include/rclcpp/any_subscription_callback.hpp +++ b/rclcpp/include/rclcpp/any_subscription_callback.hpp @@ -234,6 +234,7 @@ public: void register_callback_for_tracing() { +#ifndef TRACETOOLS_DISABLED if (shared_ptr_callback_) { TRACEPOINT( rclcpp_callback_register, @@ -255,6 +256,7 @@ public: (const void *)this, get_symbol(unique_ptr_with_info_callback_)); } +#endif // TRACETOOLS_DISABLED } private: diff --git a/rclcpp/include/rclcpp/experimental/subscription_intra_process.hpp b/rclcpp/include/rclcpp/experimental/subscription_intra_process.hpp index 0c69d0e..618db3c 100644 --- a/rclcpp/include/rclcpp/experimental/subscription_intra_process.hpp +++ b/rclcpp/include/rclcpp/experimental/subscription_intra_process.hpp @@ -97,7 +97,9 @@ public: // The callback object gets copied, so if registration is done too early/before this point // (e.g. in `AnySubscriptionCallback::set()`), its address won't match any address used later // in subsequent tracepoints. +#ifndef TRACETOOLS_DISABLED any_callback_.register_callback_for_tracing(); +#endif } bool diff --git a/rclcpp/include/rclcpp/service.hpp b/rclcpp/include/rclcpp/service.hpp index 379dcde..9b7a120 100644 --- a/rclcpp/include/rclcpp/service.hpp +++ b/rclcpp/include/rclcpp/service.hpp @@ -159,7 +159,9 @@ public: rclcpp_service_callback_added, (const void *)get_service_handle().get(), (const void *)&any_callback_); +#ifndef TRACETOOLS_DISABLED any_callback_.register_callback_for_tracing(); +#endif } Service( @@ -182,7 +184,9 @@ public: rclcpp_service_callback_added, (const void *)get_service_handle().get(), (const void *)&any_callback_); +#ifndef TRACETOOLS_DISABLED any_callback_.register_callback_for_tracing(); +#endif } Service( @@ -207,7 +211,9 @@ public: rclcpp_service_callback_added, (const void *)get_service_handle().get(), (const void *)&any_callback_); +#ifndef TRACETOOLS_DISABLED any_callback_.register_callback_for_tracing(); +#endif } Service() = delete; diff --git a/rclcpp/include/rclcpp/subscription.hpp b/rclcpp/include/rclcpp/subscription.hpp index 4a33d81..c352d57 100644 --- a/rclcpp/include/rclcpp/subscription.hpp +++ b/rclcpp/include/rclcpp/subscription.hpp @@ -176,7 +176,9 @@ public: // The callback object gets copied, so if registration is done too early/before this point // (e.g. in `AnySubscriptionCallback::set()`), its address won't match any address used later // in subsequent tracepoints. +#ifndef TRACETOOLS_DISABLED any_callback_.register_callback_for_tracing(); +#endif } /// Called after construction to continue setup that requires shared_from_this().