Skip to content

Commit

Permalink
Add tracing instrumentation to rmw_fastrtps_dynamic_cpp (#772)
Browse files Browse the repository at this point in the history
Signed-off-by: Christophe Bedard <[email protected]>
  • Loading branch information
christophebedard authored Jul 8, 2024
1 parent 1417a44 commit 549b411
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rmw_fastrtps_dynamic_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ find_package(rcpputils REQUIRED)
find_package(rcutils REQUIRED)
find_package(rmw_dds_common REQUIRED)
find_package(rmw_fastrtps_shared_cpp REQUIRED)
find_package(tracetools REQUIRED)

find_package(fastrtps_cmake_module REQUIRED)
find_package(fastcdr 2 REQUIRED CONFIG)
Expand Down Expand Up @@ -111,6 +112,7 @@ target_link_libraries(rmw_fastrtps_dynamic_cpp PUBLIC
)
target_link_libraries(rmw_fastrtps_dynamic_cpp PRIVATE
rmw_dds_common::rmw_dds_common_library
tracetools::tracetools
)

configure_rmw_library(rmw_fastrtps_dynamic_cpp)
Expand Down
3 changes: 3 additions & 0 deletions rmw_fastrtps_dynamic_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<build_depend>rosidl_runtime_c</build_depend>
<build_depend>rosidl_typesupport_introspection_c</build_depend>
<build_depend>rosidl_typesupport_introspection_cpp</build_depend>
<build_depend>tracetools</build_depend>

<build_export_depend>fastcdr</build_export_depend>
<build_export_depend>fastrtps</build_export_depend>
Expand All @@ -43,12 +44,14 @@
<build_export_depend>rosidl_runtime_c</build_export_depend>
<build_export_depend>rosidl_typesupport_introspection_c</build_export_depend>
<build_export_depend>rosidl_typesupport_introspection_cpp</build_export_depend>
<build_export_depend>tracetools</build_export_depend>

<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>osrf_testing_tools_cpp</test_depend>
<test_depend>test_msgs</test_depend>
<exec_depend>tracetools</exec_depend>

<member_of_group>rmw_implementation_packages</member_of_group>

Expand Down
7 changes: 7 additions & 0 deletions rmw_fastrtps_dynamic_cpp/src/publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

#include "rmw_fastrtps_dynamic_cpp/identifier.hpp"

#include "tracetools/tracetools.h"

#include "publisher.hpp"
#include "type_support_common.hpp"
#include "type_support_registry.hpp"
Expand Down Expand Up @@ -326,5 +328,10 @@ rmw_fastrtps_dynamic_cpp::create_publisher(
cleanup_datawriter.cancel();
return_type_support.cancel();
cleanup_info.cancel();

TRACETOOLS_TRACEPOINT(
rmw_publisher_init,
static_cast<const void *>(rmw_publisher),
info->publisher_gid.data);
return rmw_publisher;
}
7 changes: 7 additions & 0 deletions rmw_fastrtps_dynamic_cpp/src/subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

#include "rmw_fastrtps_dynamic_cpp/identifier.hpp"

#include "tracetools/tracetools.h"

#include "subscription.hpp"
#include "type_support_common.hpp"
#include "type_support_registry.hpp"
Expand Down Expand Up @@ -365,6 +367,11 @@ create_subscription(
cleanup_datareader.cancel();
return_type_support.cancel();
cleanup_info.cancel();

TRACETOOLS_TRACEPOINT(
rmw_subscription_init,
static_cast<const void *>(rmw_subscription),
info->subscription_gid_.data);
return rmw_subscription;
}

Expand Down

0 comments on commit 549b411

Please sign in to comment.