From c44b7b8c3c527a8d16739349b50340a7de9b6f51 Mon Sep 17 00:00:00 2001 From: Niklas Halle Date: Sat, 17 May 2025 14:21:56 +0200 Subject: [PATCH 1/2] WIP: backport message flow tracing to foxy --- src/priority_executor/CMakeLists.txt | 3 +++ src/priority_executor/package.xml | 1 + 2 files changed, 4 insertions(+) diff --git a/src/priority_executor/CMakeLists.txt b/src/priority_executor/CMakeLists.txt index e6ec3da..2bceac0 100755 --- a/src/priority_executor/CMakeLists.txt +++ b/src/priority_executor/CMakeLists.txt @@ -13,6 +13,7 @@ endif() # Find dependencies find_package(ament_cmake REQUIRED) +find_package(tracetools REQUIRED) find_package(rclcpp REQUIRED) find_package(rcl REQUIRED) find_package(rmw REQUIRED) @@ -35,6 +36,7 @@ target_include_directories(priority_executor PUBLIC $ ) ament_target_dependencies(priority_executor + tracetools rmw rclcpp rcl @@ -54,6 +56,7 @@ target_link_libraries(usage_example priority_executor ) ament_target_dependencies(usage_example + tracetools rclcpp std_msgs std_srvs diff --git a/src/priority_executor/package.xml b/src/priority_executor/package.xml index faaedb5..0567034 100755 --- a/src/priority_executor/package.xml +++ b/src/priority_executor/package.xml @@ -11,6 +11,7 @@ ament_cmake + tracetools rclcpp rcl rmw From 5f73198adbabb3a34985fb5e5c7f84b5e4149a86 Mon Sep 17 00:00:00 2001 From: Niklas Halle Date: Mon, 9 Jun 2025 15:21:21 +0200 Subject: [PATCH 2/2] added tracepoints, removed cout --- src/priority_executor/src/priority_executor.cpp | 2 ++ src/priority_executor/src/priority_memory_strategy.cpp | 4 ++-- src/priority_executor/src/usage_example.cpp | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/priority_executor/src/priority_executor.cpp b/src/priority_executor/src/priority_executor.cpp index f9eee3e..a3662c0 100755 --- a/src/priority_executor/src/priority_executor.cpp +++ b/src/priority_executor/src/priority_executor.cpp @@ -95,6 +95,7 @@ bool TimedExecutor::get_next_executable( void TimedExecutor::wait_for_work(std::chrono::nanoseconds timeout) { + TRACEPOINT(rclcpp_executor_wait_for_work, timeout.count()); { std::unique_lock lock(memory_strategy_mutex_); @@ -166,6 +167,7 @@ TimedExecutor::wait_for_work(std::chrono::nanoseconds timeout) bool TimedExecutor::get_next_ready_executable(rclcpp::AnyExecutable &any_executable) { + TRACEPOINT(rclcpp_executor_get_next_ready); bool success = false; if (use_priorities) { diff --git a/src/priority_executor/src/priority_memory_strategy.cpp b/src/priority_executor/src/priority_memory_strategy.cpp index 68f6295..df99999 100755 --- a/src/priority_executor/src/priority_memory_strategy.cpp +++ b/src/priority_executor/src/priority_memory_strategy.cpp @@ -255,8 +255,8 @@ PriorityExecutable::PriorityExecutable( ExecutableType t, ExecutableScheduleType sched_type) { handle = std::move(h); - std::cout << "priority_executable constructor called" << std::endl; - std::cout << "type: " << t << std::endl; + //std::cout << "priority_executable constructor called" << std::endl; + //std::cout << "type: " << t << std::endl; type = t; if (sched_type == ExecutableScheduleType::CHAIN_INDEPENDENT_PRIORITY diff --git a/src/priority_executor/src/usage_example.cpp b/src/priority_executor/src/usage_example.cpp index b9c4b4c..c645d5c 100755 --- a/src/priority_executor/src/usage_example.cpp +++ b/src/priority_executor/src/usage_example.cpp @@ -76,8 +76,7 @@ int main(int argc, char* argv[]) { strategy->set_executable_deadline(talker->timer_->get_timer_handle(), 1000, priority_executor::ExecutableType::TIMER, 0); // you _must_ set the timer_handle for each chain - strategy->get_priority_settings(talker->timer_->get_timer_handle()) - ->timer_handle = talker->timer_; + strategy->get_priority_settings(talker->timer_->get_timer_handle())->timer_handle = talker->timer_; // you _must_ mark the first executable in the chain strategy->set_first_in_chain(talker->timer_->get_timer_handle()); // set the same period and chain_id for each callback in the chain