Skip to content

Commit

Permalink
Revert "Add tracepoint for generic publisher/subscriber (ros2#2448)"
Browse files Browse the repository at this point in the history
This reverts commit f510db1.
  • Loading branch information
CursedRock17 committed Apr 2, 2024
1 parent f510db1 commit ba25a58
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 25 deletions.
26 changes: 10 additions & 16 deletions rclcpp/include/rclcpp/generic_subscription.hpp
Expand Up @@ -84,22 +84,13 @@ class GenericSubscription : public rclcpp::SubscriptionBase
options.event_callbacks,
options.use_default_callbacks,
DeliveredMessageKind::SERIALIZED_MESSAGE),
any_callback_(callback),
callback_([callback](
std::shared_ptr<const rclcpp::SerializedMessage> serialized_message,
const rclcpp::MessageInfo & message_info) mutable {
callback.dispatch(serialized_message, message_info);
}),
ts_lib_(ts_lib)
{
TRACETOOLS_TRACEPOINT(
rclcpp_subscription_init,
static_cast<const void *>(get_subscription_handle().get()),
static_cast<const void *>(this));
TRACETOOLS_TRACEPOINT(
rclcpp_subscription_callback_added,
static_cast<const void *>(this),
static_cast<const void *>(&any_callback_));

#ifndef TRACETOOLS_DISABLED
any_callback_.register_callback_for_tracing();
#endif
}
{}

RCLCPP_PUBLIC
virtual ~GenericSubscription() = default;
Expand Down Expand Up @@ -162,7 +153,10 @@ class GenericSubscription : public rclcpp::SubscriptionBase

private:
RCLCPP_DISABLE_COPY(GenericSubscription)
AnySubscriptionCallback<rclcpp::SerializedMessage, std::allocator<void>> any_callback_;

std::function<void(
std::shared_ptr<const rclcpp::SerializedMessage>,
const rclcpp::MessageInfo)> callback_;
// The type support library should stay loaded, so it is stored in the GenericSubscription
std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
};
Expand Down
5 changes: 0 additions & 5 deletions rclcpp/src/rclcpp/generic_publisher.cpp
Expand Up @@ -23,10 +23,6 @@ namespace rclcpp

void GenericPublisher::publish(const rclcpp::SerializedMessage & message)
{
TRACETOOLS_TRACEPOINT(
rclcpp_publish,
nullptr,
static_cast<const void *>(&message.get_rcl_serialized_message()));
auto return_code = rcl_publish_serialized_message(
get_publisher_handle().get(), &message.get_rcl_serialized_message(), NULL);

Expand Down Expand Up @@ -72,7 +68,6 @@ void GenericPublisher::deserialize_message(

void GenericPublisher::publish_loaned_message(void * loaned_message)
{
TRACETOOLS_TRACEPOINT(rclcpp_publish, nullptr, static_cast<const void *>(loaned_message));
auto return_code = rcl_publish_loaned_message(
get_publisher_handle().get(), loaned_message, NULL);

Expand Down
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/generic_subscription.cpp
Expand Up @@ -51,7 +51,7 @@ GenericSubscription::handle_serialized_message(
const std::shared_ptr<rclcpp::SerializedMessage> & message,
const rclcpp::MessageInfo & message_info)
{
any_callback_.dispatch(message, message_info);
callback_(message, message_info);
}

void
Expand Down
3 changes: 0 additions & 3 deletions rclcpp/src/rclcpp/subscription_base.cpp
Expand Up @@ -244,9 +244,6 @@ SubscriptionBase::take_serialized(
&message_out.get_rcl_serialized_message(),
&message_info_out.get_rmw_message_info(),
nullptr);
TRACETOOLS_TRACEPOINT(
rclcpp_take,
static_cast<const void *>(&message_out.get_rcl_serialized_message()));
if (RCL_RET_SUBSCRIPTION_TAKE_FAILED == ret) {
return false;
} else if (RCL_RET_OK != ret) {
Expand Down

0 comments on commit ba25a58

Please sign in to comment.