Put subscription callback tracepoints in intraprocess subscription too (#918)
* Put subscription callback tracepoints in intraprocess subscription too Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai> * Add missing tracetools header Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai> * Move Subscription tracepoints back to outside of intra-process condition Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai> * Revert API change by adding new tracepoint as an intermediate Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
This commit is contained in:
parent
5254e6abc3
commit
1f79bdb3f7
2 changed files with 19 additions and 1 deletions
|
@ -30,6 +30,7 @@
|
||||||
#include "rclcpp/experimental/subscription_intra_process_base.hpp"
|
#include "rclcpp/experimental/subscription_intra_process_base.hpp"
|
||||||
#include "rclcpp/type_support_decl.hpp"
|
#include "rclcpp/type_support_decl.hpp"
|
||||||
#include "rclcpp/waitable.hpp"
|
#include "rclcpp/waitable.hpp"
|
||||||
|
#include "tracetools/tracetools.h"
|
||||||
|
|
||||||
namespace rclcpp
|
namespace rclcpp
|
||||||
{
|
{
|
||||||
|
@ -88,6 +89,15 @@ public:
|
||||||
if (RCL_RET_OK != ret) {
|
if (RCL_RET_OK != ret) {
|
||||||
throw std::runtime_error("SubscriptionIntraProcess init error initializing guard condition");
|
throw std::runtime_error("SubscriptionIntraProcess init error initializing guard condition");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRACEPOINT(
|
||||||
|
rclcpp_subscription_callback_added,
|
||||||
|
(const void *)this,
|
||||||
|
(const void *)&any_callback_);
|
||||||
|
// 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.
|
||||||
|
any_callback_.register_callback_for_tracing();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -152,6 +152,10 @@ public:
|
||||||
qos.get_rmw_qos_profile(),
|
qos.get_rmw_qos_profile(),
|
||||||
resolve_intra_process_buffer_type(options.intra_process_buffer_type, callback)
|
resolve_intra_process_buffer_type(options.intra_process_buffer_type, callback)
|
||||||
);
|
);
|
||||||
|
TRACEPOINT(
|
||||||
|
rclcpp_subscription_init,
|
||||||
|
(const void *)get_subscription_handle().get(),
|
||||||
|
(const void *)subscription_intra_process.get());
|
||||||
|
|
||||||
// Add it to the intra process manager.
|
// Add it to the intra process manager.
|
||||||
using rclcpp::experimental::IntraProcessManager;
|
using rclcpp::experimental::IntraProcessManager;
|
||||||
|
@ -161,8 +165,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACEPOINT(
|
TRACEPOINT(
|
||||||
rclcpp_subscription_callback_added,
|
rclcpp_subscription_init,
|
||||||
(const void *)get_subscription_handle().get(),
|
(const void *)get_subscription_handle().get(),
|
||||||
|
(const void *)this);
|
||||||
|
TRACEPOINT(
|
||||||
|
rclcpp_subscription_callback_added,
|
||||||
|
(const void *)this,
|
||||||
(const void *)&any_callback_);
|
(const void *)&any_callback_);
|
||||||
// The callback object gets copied, so if registration is done too early/before this point
|
// 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
|
// (e.g. in `AnySubscriptionCallback::set()`), its address won't match any address used later
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue