Skip to content

Make sure callback_end tracepoint is triggered in AnyServiceCallback#2670

Merged
christophebedard merged 1 commit intorollingfrom
christophebedard/any-service-callback-make-sure-callback-end-tracepoint-is-triggered
Nov 11, 2024
Merged

Make sure callback_end tracepoint is triggered in AnyServiceCallback#2670
christophebedard merged 1 commit intorollingfrom
christophebedard/any-service-callback-make-sure-callback-end-tracepoint-is-triggered

Conversation

@christophebedard
Copy link
Copy Markdown
Member

@christophebedard christophebedard commented Nov 10, 2024

The callback_end tracepoint was triggered at the end of the dispatch() method, but there is more than 1 return.

Relates to ros2/ros2_tracing#144

Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
@christophebedard
Copy link
Copy Markdown
Member Author

We could use RCPPUTILS_SCOPE_EXIT at the top of the dispatch() method instead:

   {
     TRACETOOLS_TRACEPOINT(callback_start, static_cast<const void *>(this), false);
+#ifndef TRACETOOLS_DISABLED
+    RCPPUTILS_SCOPE_EXIT({TRACETOOLS_TRACEPOINT(callback_end, static_cast<const void *>(this));});
+#endif  // TRACETOOLS_DISABLED

Copy link
Copy Markdown
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use RCPPUTILS_SCOPE_EXIT at the top of the dispatch() method instead:

     TRACETOOLS_TRACEPOINT(callback_start, static_cast<const void *>(this), false);
+#ifndef TRACETOOLS_DISABLED
+    RCPPUTILS_SCOPE_EXIT({TRACETOOLS_TRACEPOINT(callback_end, static_cast<const void *>(this));});
+#endif  // TRACETOOLS_DISABLED

While I'm usually a fan of using scope exit where possible, it is a little ugly in this case, and the function is short anyway. Thus, I'm fine with what you've done here, with green CI.

@christophebedard
Copy link
Copy Markdown
Member Author

Pulls: ros2/ros2_tracing#144, #2670
Gist: https://gist.githubusercontent.com/christophebedard/b3572b9fa2f4051bb29d608e9ea6d45a/raw/7344d55e9c011cd93cf654afa10ea4e7c889938c/ros2.repos
BUILD args: --packages-above-and-dependencies rclcpp test_tracetools
TEST args: --packages-above rclcpp test_tracetools
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/14807

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@christophebedard christophebedard merged commit 88ebea9 into rolling Nov 11, 2024
@christophebedard christophebedard deleted the christophebedard/any-service-callback-make-sure-callback-end-tracepoint-is-triggered branch November 11, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants