Skip to content

Commit ba25a58

Browse files
committed
Revert "Add tracepoint for generic publisher/subscriber (ros2#2448)"
This reverts commit f510db1.
1 parent f510db1 commit ba25a58

File tree

4 files changed

+11
-25
lines changed

4 files changed

+11
-25
lines changed

rclcpp/include/rclcpp/generic_subscription.hpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,13 @@ class GenericSubscription : public rclcpp::SubscriptionBase
8484
options.event_callbacks,
8585
options.use_default_callbacks,
8686
DeliveredMessageKind::SERIALIZED_MESSAGE),
87-
any_callback_(callback),
87+
callback_([callback](
88+
std::shared_ptr<const rclcpp::SerializedMessage> serialized_message,
89+
const rclcpp::MessageInfo & message_info) mutable {
90+
callback.dispatch(serialized_message, message_info);
91+
}),
8892
ts_lib_(ts_lib)
89-
{
90-
TRACETOOLS_TRACEPOINT(
91-
rclcpp_subscription_init,
92-
static_cast<const void *>(get_subscription_handle().get()),
93-
static_cast<const void *>(this));
94-
TRACETOOLS_TRACEPOINT(
95-
rclcpp_subscription_callback_added,
96-
static_cast<const void *>(this),
97-
static_cast<const void *>(&any_callback_));
98-
99-
#ifndef TRACETOOLS_DISABLED
100-
any_callback_.register_callback_for_tracing();
101-
#endif
102-
}
93+
{}
10394

10495
RCLCPP_PUBLIC
10596
virtual ~GenericSubscription() = default;
@@ -162,7 +153,10 @@ class GenericSubscription : public rclcpp::SubscriptionBase
162153

163154
private:
164155
RCLCPP_DISABLE_COPY(GenericSubscription)
165-
AnySubscriptionCallback<rclcpp::SerializedMessage, std::allocator<void>> any_callback_;
156+
157+
std::function<void(
158+
std::shared_ptr<const rclcpp::SerializedMessage>,
159+
const rclcpp::MessageInfo)> callback_;
166160
// The type support library should stay loaded, so it is stored in the GenericSubscription
167161
std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
168162
};

rclcpp/src/rclcpp/generic_publisher.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ namespace rclcpp
2323

2424
void GenericPublisher::publish(const rclcpp::SerializedMessage & message)
2525
{
26-
TRACETOOLS_TRACEPOINT(
27-
rclcpp_publish,
28-
nullptr,
29-
static_cast<const void *>(&message.get_rcl_serialized_message()));
3026
auto return_code = rcl_publish_serialized_message(
3127
get_publisher_handle().get(), &message.get_rcl_serialized_message(), NULL);
3228

@@ -72,7 +68,6 @@ void GenericPublisher::deserialize_message(
7268

7369
void GenericPublisher::publish_loaned_message(void * loaned_message)
7470
{
75-
TRACETOOLS_TRACEPOINT(rclcpp_publish, nullptr, static_cast<const void *>(loaned_message));
7671
auto return_code = rcl_publish_loaned_message(
7772
get_publisher_handle().get(), loaned_message, NULL);
7873

rclcpp/src/rclcpp/generic_subscription.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ GenericSubscription::handle_serialized_message(
5151
const std::shared_ptr<rclcpp::SerializedMessage> & message,
5252
const rclcpp::MessageInfo & message_info)
5353
{
54-
any_callback_.dispatch(message, message_info);
54+
callback_(message, message_info);
5555
}
5656

5757
void

rclcpp/src/rclcpp/subscription_base.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,6 @@ SubscriptionBase::take_serialized(
244244
&message_out.get_rcl_serialized_message(),
245245
&message_info_out.get_rmw_message_info(),
246246
nullptr);
247-
TRACETOOLS_TRACEPOINT(
248-
rclcpp_take,
249-
static_cast<const void *>(&message_out.get_rcl_serialized_message()));
250247
if (RCL_RET_SUBSCRIPTION_TAKE_FAILED == ret) {
251248
return false;
252249
} else if (RCL_RET_OK != ret) {

0 commit comments

Comments
 (0)