Skip to content

Commit 549b411

Browse files
Add tracing instrumentation to rmw_fastrtps_dynamic_cpp (#772)
Signed-off-by: Christophe Bedard <[email protected]>
1 parent 1417a44 commit 549b411

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

rmw_fastrtps_dynamic_cpp/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ find_package(rcpputils REQUIRED)
3636
find_package(rcutils REQUIRED)
3737
find_package(rmw_dds_common REQUIRED)
3838
find_package(rmw_fastrtps_shared_cpp REQUIRED)
39+
find_package(tracetools REQUIRED)
3940

4041
find_package(fastrtps_cmake_module REQUIRED)
4142
find_package(fastcdr 2 REQUIRED CONFIG)
@@ -111,6 +112,7 @@ target_link_libraries(rmw_fastrtps_dynamic_cpp PUBLIC
111112
)
112113
target_link_libraries(rmw_fastrtps_dynamic_cpp PRIVATE
113114
rmw_dds_common::rmw_dds_common_library
115+
tracetools::tracetools
114116
)
115117

116118
configure_rmw_library(rmw_fastrtps_dynamic_cpp)

rmw_fastrtps_dynamic_cpp/package.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<build_depend>rosidl_runtime_c</build_depend>
3232
<build_depend>rosidl_typesupport_introspection_c</build_depend>
3333
<build_depend>rosidl_typesupport_introspection_cpp</build_depend>
34+
<build_depend>tracetools</build_depend>
3435

3536
<build_export_depend>fastcdr</build_export_depend>
3637
<build_export_depend>fastrtps</build_export_depend>
@@ -43,12 +44,14 @@
4344
<build_export_depend>rosidl_runtime_c</build_export_depend>
4445
<build_export_depend>rosidl_typesupport_introspection_c</build_export_depend>
4546
<build_export_depend>rosidl_typesupport_introspection_cpp</build_export_depend>
47+
<build_export_depend>tracetools</build_export_depend>
4648

4749
<test_depend>ament_cmake_gtest</test_depend>
4850
<test_depend>ament_lint_auto</test_depend>
4951
<test_depend>ament_lint_common</test_depend>
5052
<test_depend>osrf_testing_tools_cpp</test_depend>
5153
<test_depend>test_msgs</test_depend>
54+
<exec_depend>tracetools</exec_depend>
5255

5356
<member_of_group>rmw_implementation_packages</member_of_group>
5457

rmw_fastrtps_dynamic_cpp/src/publisher.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545

4646
#include "rmw_fastrtps_dynamic_cpp/identifier.hpp"
4747

48+
#include "tracetools/tracetools.h"
49+
4850
#include "publisher.hpp"
4951
#include "type_support_common.hpp"
5052
#include "type_support_registry.hpp"
@@ -326,5 +328,10 @@ rmw_fastrtps_dynamic_cpp::create_publisher(
326328
cleanup_datawriter.cancel();
327329
return_type_support.cancel();
328330
cleanup_info.cancel();
331+
332+
TRACETOOLS_TRACEPOINT(
333+
rmw_publisher_init,
334+
static_cast<const void *>(rmw_publisher),
335+
info->publisher_gid.data);
329336
return rmw_publisher;
330337
}

rmw_fastrtps_dynamic_cpp/src/subscription.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151

5252
#include "rmw_fastrtps_dynamic_cpp/identifier.hpp"
5353

54+
#include "tracetools/tracetools.h"
55+
5456
#include "subscription.hpp"
5557
#include "type_support_common.hpp"
5658
#include "type_support_registry.hpp"
@@ -365,6 +367,11 @@ create_subscription(
365367
cleanup_datareader.cancel();
366368
return_type_support.cancel();
367369
cleanup_info.cancel();
370+
371+
TRACETOOLS_TRACEPOINT(
372+
rmw_subscription_init,
373+
static_cast<const void *>(rmw_subscription),
374+
info->subscription_gid_.data);
368375
return rmw_subscription;
369376
}
370377

0 commit comments

Comments
 (0)