Skip to content

Commit

Permalink
add extra info to time keeper warning
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Sanchez <[email protected]>
  • Loading branch information
danielsanchezaran committed Nov 27, 2024
1 parent 12a86f6 commit bf93adf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions common/autoware_universe_utils/src/system/time_keeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <fmt/format.h>

#include <stdexcept>
#include <string>

namespace autoware::universe_utils
{
Expand Down Expand Up @@ -135,9 +136,10 @@ void TimeKeeper::start_track(const std::string & func_name)
root_node_thread_id_ = std::this_thread::get_id();
} else {
if (root_node_thread_id_ != std::this_thread::get_id()) {
RCLCPP_WARN(
rclcpp::get_logger("TimeKeeper"),
"TimeKeeper::start_track() is called from a different thread. Ignoring the call.");
const auto warning_msg = fmt::format(
"TimeKeeper::start_track({}) is called from a different thread. Ignoring the call",
func_name);
RCLCPP_WARN(rclcpp::get_logger("TimeKeeper"), "%s", warning_msg.c_str());
return;
}
current_time_node_ = current_time_node_->add_child(func_name);
Expand Down

0 comments on commit bf93adf

Please sign in to comment.