Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions realtime_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS
rclcpp_action
Threads
rcpputils
fmt
)

find_package(ament_cmake REQUIRED)
Expand All @@ -44,7 +45,13 @@ target_include_directories(realtime_tools PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/realtime_tools>
)
target_link_libraries(realtime_tools PUBLIC rclcpp::rclcpp rclcpp_action::rclcpp_action rcpputils::rcpputils Threads::Threads Boost::boost)
target_link_libraries(realtime_tools PUBLIC
rclcpp::rclcpp
rclcpp_action::rclcpp_action
rcpputils::rcpputils
Threads::Threads
Boost::boost
fmt::fmt)
if(UNIX AND NOT APPLE)
target_link_libraries(realtime_tools PUBLIC cap)
endif()
Expand All @@ -69,6 +76,7 @@ if(BUILD_TESTING)
find_package(lifecycle_msgs REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(test_msgs REQUIRED)
find_package(fmt REQUIRED)

ament_add_gmock(thread_priority_tests test/thread_priority_tests.cpp)
target_link_libraries(thread_priority_tests thread_priority)
Expand Down Expand Up @@ -104,7 +112,8 @@ if(BUILD_TESTING)
realtime_tools
thread_priority
${lifecycle_msgs_TARGETS}
rclcpp_lifecycle::rclcpp_lifecycle)
rclcpp_lifecycle::rclcpp_lifecycle
fmt::fmt)

if(NOT WIN32)
ament_add_gmock(realtime_mutex_tests test/realtime_mutex_tests.cpp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#ifndef REALTIME_TOOLS__ASYNC_FUNCTION_HANDLER_HPP_
#define REALTIME_TOOLS__ASYNC_FUNCTION_HANDLER_HPP_

#include <fmt/format.h>
#include <fmt/ranges.h>
#include <atomic>
#include <cmath>
#include <condition_variable>
Expand Down Expand Up @@ -568,9 +570,13 @@ class AsyncFunctionHandler
params_.logger, !affinity_result.first,
"Could not set CPU affinity for the async worker thread. Error: %s",
affinity_result.second.c_str());

std::string cores_list_print =
fmt::format("[{}]", fmt::join(params_.cpu_affinity_cores, ", "));

RCLCPP_WARN_EXPRESSION(
params_.logger, affinity_result.first,
"Async worker thread is successfully pinned to the requested CPU cores!");
"Async worker thread successfully pinned to Cores: %s", cores_list_print.c_str());
}
if (!params_.thread_name.empty()) {
const auto rename_result = realtime_tools::set_current_thread_name(params_.thread_name);
Expand Down
1 change: 1 addition & 0 deletions realtime_tools/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<depend>rclcpp</depend>
<depend>rclcpp_action</depend>
<depend>libcap-dev</depend>
<depend>fmt</depend>

<test_depend>ament_cmake_gmock</test_depend>
<test_depend>lifecycle_msgs</test_depend>
Expand Down
Loading