Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: jazzy support #306

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions CARET_trace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
find_package(LTTngUST REQUIRED)
find_package(caret_msgs REQUIRED)

set(ENV_VAR_VALUE $ENV{ROS_DISTRO})
if(ENV_VAR_VALUE STREQUAL "jazzy")
add_compile_definitions(ROS_DISTRO_JAZZY)
endif()

add_library(caret SHARED
src/ros_trace_points.cpp
src/hooked_trace_points.cpp
Expand Down Expand Up @@ -66,7 +71,7 @@

add_executable(clock_recorder src/clock_recorder.cpp src/tp.c)
ament_target_dependencies(clock_recorder rclcpp LTTngUST)
target_link_libraries(clock_recorder ${LTTNGUST_LIBRARIES})

Check warning on line 74 in CARET_trace/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (LTTNGUST)

install(TARGETS
clock_recorder
Expand Down
61 changes: 61 additions & 0 deletions CARET_trace/include/caret_trace/data_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ class DataContainer : public DataContainerInterface
using ConstructStaticExecutor =
ContainerTraits<const void *, const void *, const char *, int64_t>;

/// @brief ContainerTraits for callback_group_to_executor_entity_collector trace points.
using CallbackGroupToExecutorEntityCollector =
ContainerTraits<const void *, const void *, int64_t>;

/// @brief ContainerTraits for executor_entity_collector_to_executor trace points.
using ExecutorEntityCollectorToExecutor = ContainerTraits<const void *, const void *, int64_t>;

/// @brief ContainerTraits for rcl_init trace points.
using RclInit = ContainerTraits<const void *, int64_t>;

Expand Down Expand Up @@ -145,6 +152,10 @@ class DataContainer : public DataContainerInterface
/// @param callback_group_add_timer Data instance for callback_group_add_timer trace point.
/// @param construct_executor Data instance for construct_executor trace point.
/// @param construct_static_executor Data instance for construct_static_executor trace point.
/// @param callback_group_to_executor_entity_collector Data instance for
/// callback_group_to_executor_entity_collector trace point.
/// @param executor_entity_collector_to_executor Data instance for
/// executor_entity_collector_to_executor trace point.
Comment on lines +156 to +159
Copy link
Contributor

Choose a reason for hiding this comment

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

Conditional compilation may need to be applied here.
When building with humble, the function arguments and comments will not match.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

conditional compilation applied

/// @param rcl_client_init Data instance for rcl_client_init trace point.
/// @param rcl_init Data instance for rcl_init trace point.
/// @param rcl_node_init Data instance for rcl_node_init trace point.
Expand All @@ -170,6 +181,11 @@ class DataContainer : public DataContainerInterface
std::shared_ptr<CallbackGroupAddTimer::KeysT> callback_group_add_timer,
std::shared_ptr<ConstructExecutor::KeysT> construct_executor,
std::shared_ptr<ConstructStaticExecutor::KeysT> construct_static_executor,
#ifdef ROS_DISTRO_JAZZY
std::shared_ptr<CallbackGroupToExecutorEntityCollector::KeysT>
callback_group_to_executor_entity_collector,
std::shared_ptr<ExecutorEntityCollectorToExecutor::KeysT> executor_entity_collector_to_executor,
#endif
std::shared_ptr<RclClientInit::KeysT> rcl_client_init, std::shared_ptr<RclInit::KeysT> rcl_init,
std::shared_ptr<RclNodeInit::KeysT> rcl_node_init,
std::shared_ptr<RclPublisherInit::KeysT> rcl_publisher_init,
Expand Down Expand Up @@ -281,6 +297,28 @@ class DataContainer : public DataContainerInterface
return construct_static_executor_->store(args...);
}

/// @brief Store data for callback_group_to_executor_entity_collector trace points.
/// @tparam ...Args Data types to be stored.
/// @param ...args Data to be stored.
/// @return True, data was stored to pending set.
/// @return False, data was stored to set.
template <typename... Args>
bool store_callback_group_to_executor_entity_collector(Args... args)
{
return callback_group_to_executor_entity_collector_->store(args...);
}

/// @brief Store data for executor_entity_collector_to_executor trace points.
/// @tparam ...Args Data types to be stored.
/// @param ...args Data to be stored.
/// @return True, data was stored to pending set.
/// @return False, data was stored to set.
template <typename... Args>
bool store_executor_entity_collector_to_executor(Args... args)
{
return executor_entity_collector_to_executor_->store(args...);
}
ymski marked this conversation as resolved.
Show resolved Hide resolved

/// @brief Store data for rcl_node_init trace points.
/// @tparam ...Args Data types to be stored.
/// @param ...args Data to be stored.
Expand Down Expand Up @@ -500,6 +538,16 @@ class DataContainer : public DataContainerInterface
/// @param record recording function.
void assign_construct_static_executor(ConstructStaticExecutor::StdFuncT record);

/// @brief Assign recording function for callback_group_to_executor_entity_collector trace points.
/// @param record recording function.
void assign_callback_group_to_executor_entity_collector(
CallbackGroupToExecutorEntityCollector::StdFuncT record);

/// @brief Assign recording function for executor_entity_collector_to_executor trace points.
/// @param record recording function.
void assign_executor_entity_collector_to_executor(
ExecutorEntityCollectorToExecutor::StdFuncT record);

ymski marked this conversation as resolved.
Show resolved Hide resolved
/// @brief Assign recording function for rcl_client_init trace points.
/// @param record recording function.
void assign_rcl_client_init(RclClientInit::StdFuncT record);
Expand Down Expand Up @@ -609,6 +657,16 @@ class DataContainer : public DataContainerInterface
/// @return True if function is assigned, false otherwise.
bool is_assigned_construct_static_executor() const;

/// @brief Check whether recording function for callback_group_to_executor_entity_collector trace
/// point is assigned.
/// @return True if function is assigned, false otherwise.
bool is_assigned_callback_group_to_executor_entity_collector() const;

/// @brief Check whether recording function for executor_entity_collector_to_executor trace point
/// is assigned.
/// @return True if function is assigned, false otherwise.
bool is_assigned_executor_entity_collector_to_executor() const;
ymski marked this conversation as resolved.
Show resolved Hide resolved

/// @brief Check whether recording function for rcl_client_init trace point is assigned.
/// @return True if function is assigned, false otherwise.
bool is_assigned_rcl_client_init() const;
Expand Down Expand Up @@ -697,6 +755,9 @@ class DataContainer : public DataContainerInterface
std::shared_ptr<CallbackGroupAddTimer::KeysT> callback_group_add_timer_;
std::shared_ptr<ConstructExecutor::KeysT> construct_executor_;
std::shared_ptr<ConstructStaticExecutor::KeysT> construct_static_executor_;
std::shared_ptr<CallbackGroupToExecutorEntityCollector::KeysT>
callback_group_to_executor_entity_collector_;
std::shared_ptr<ExecutorEntityCollectorToExecutor::KeysT> executor_entity_collector_to_executor_;
ymski marked this conversation as resolved.
Show resolved Hide resolved
std::shared_ptr<RclClientInit::KeysT> rcl_client_init_;
std::shared_ptr<RclInit::KeysT> rcl_init_;
std::shared_ptr<RclNodeInit::KeysT> rcl_node_init_;
Expand Down
47 changes: 47 additions & 0 deletions CARET_trace/include/caret_trace/tp.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ TRACEPOINT_EVENT(
)
)

#ifdef ROS_DISTRO_JAZZY
TRACEPOINT_EVENT(
ymski marked this conversation as resolved.
Show resolved Hide resolved
TRACEPOINT_PROVIDER,
dds_write,
TP_ARGS(
const void *, rmw_publisher_handle_arg,
const void *, message_arg,
int64_t, init_timestamp_arg
),
TP_FIELDS(
ctf_integer_hex(const void *, rmw_publisher_handle, rmw_publisher_handle_arg)
ctf_integer_hex(const void *, message, message_arg)
ctf_integer(const int64_t, init_timestamp, init_timestamp_arg)
)
)
#else
TRACEPOINT_EVENT(
TRACEPOINT_PROVIDER,
dds_write,
Expand All @@ -53,6 +69,7 @@ TRACEPOINT_EVENT(
ctf_integer_hex(const void *, message, message_arg)
)
)
#endif

TRACEPOINT_EVENT(
TRACEPOINT_PROVIDER,
Expand Down Expand Up @@ -93,6 +110,36 @@ TRACEPOINT_EVENT(
)
)

TRACEPOINT_EVENT(
TRACEPOINT_PROVIDER,
callback_group_to_executor_entity_collector,
TP_ARGS(
const void *, executor_entities_collector_addr_arg,
const void *, callback_group_addr_arg,
int64_t, init_timestamp_arg
),
TP_FIELDS(
ctf_integer_hex(const void *, executor_entities_collector_addr, executor_entities_collector_addr_arg)
ctf_integer_hex(const void *, callback_group_addr, callback_group_addr_arg)
ctf_integer(const int64_t, init_timestamp, init_timestamp_arg)
)
)

TRACEPOINT_EVENT(
TRACEPOINT_PROVIDER,
executor_entity_collector_to_executor,
TP_ARGS(
const void *, executor_addr_arg,
const void *, executor_entities_collector_addr_arg,
int64_t, init_timestamp_arg
),
TP_FIELDS(
ctf_integer_hex(const void *, executor_addr, executor_addr_arg)
ctf_integer_hex(const void *, executor_entities_collector_addr, executor_entities_collector_addr_arg)
ctf_integer(const int64_t, init_timestamp, init_timestamp_arg)
)
)

TRACEPOINT_EVENT(
TRACEPOINT_PROVIDER,
construct_executor,
Expand Down
53 changes: 53 additions & 0 deletions CARET_trace/src/data_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ DataContainer::DataContainer()
std::make_shared<CallbackGroupAddTimer::KeysT>("callback_group_add_timer"),
std::make_shared<ConstructExecutor::KeysT>("construct_executor"),
std::make_shared<ConstructStaticExecutor::KeysT>("construct_static_executor"),
#ifdef ROS_DISTRO_JAZZY
std::make_shared<CallbackGroupToExecutorEntityCollector::KeysT>(
"callback_group_to_executor_entity_collector"),
std::make_shared<ExecutorEntityCollectorToExecutor::KeysT>(
"executor_entity_collector_to_executor"),
#endif
std::make_shared<RclClientInit::KeysT>("rcl_client_init"),
std::make_shared<RclInit::KeysT>("rcl_init"),
std::make_shared<RclNodeInit::KeysT>("rcl_node_init"),
Expand Down Expand Up @@ -66,6 +72,11 @@ DataContainer::DataContainer(
std::shared_ptr<CallbackGroupAddTimer::KeysT> callback_group_add_timer,
std::shared_ptr<ConstructExecutor::KeysT> construct_executor,
std::shared_ptr<ConstructStaticExecutor::KeysT> construct_static_executor,
#ifdef ROS_DISTRO_JAZZY
std::shared_ptr<CallbackGroupToExecutorEntityCollector::KeysT>
callback_group_to_executor_entity_collector,
std::shared_ptr<ExecutorEntityCollectorToExecutor::KeysT> executor_entity_collector_to_executor,
#endif
std::shared_ptr<RclClientInit::KeysT> rcl_client_init, std::shared_ptr<RclInit::KeysT> rcl_init,
std::shared_ptr<RclNodeInit::KeysT> rcl_node_init,
std::shared_ptr<RclPublisherInit::KeysT> rcl_publisher_init,
Expand All @@ -90,6 +101,10 @@ DataContainer::DataContainer(
callback_group_add_timer_(callback_group_add_timer),
construct_executor_(construct_executor),
construct_static_executor_(construct_static_executor),
#ifdef ROS_DISTRO_JAZZY
callback_group_to_executor_entity_collector_(callback_group_to_executor_entity_collector),
executor_entity_collector_to_executor_(executor_entity_collector_to_executor),
#endif
rcl_client_init_(rcl_client_init),
rcl_init_(rcl_init),
rcl_node_init_(rcl_node_init),
Expand Down Expand Up @@ -134,6 +149,14 @@ DataContainer::DataContainer(
if (construct_static_executor_) {
recordable_data.emplace_back(construct_static_executor_);
}
#ifdef ROS_DISTRO_JAZZY
if (callback_group_to_executor_entity_collector_) {
recordable_data.emplace_back(callback_group_to_executor_entity_collector_);
}
if (executor_entity_collector_to_executor_) {
recordable_data.emplace_back(executor_entity_collector_to_executor_);
}
#endif
if (rcl_client_init_) {
recordable_data.emplace_back(rcl_client_init_);
}
Expand Down Expand Up @@ -273,6 +296,22 @@ void DataContainer::assign_construct_static_executor(ConstructStaticExecutor::St
construct_static_executor_->assign(record);
}

#ifdef ROS_DISTRO_JAZZY
void DataContainer::assign_callback_group_to_executor_entity_collector(
CallbackGroupToExecutorEntityCollector::StdFuncT record)
{
assert(callback_group_to_executor_entity_collector_.get() != nullptr);
callback_group_to_executor_entity_collector_->assign(record);
}

void DataContainer::assign_executor_entity_collector_to_executor(
ExecutorEntityCollectorToExecutor::StdFuncT record)
{
assert(executor_entity_collector_to_executor_.get() != nullptr);
executor_entity_collector_to_executor_->assign(record);
}
#endif

void DataContainer::assign_rcl_client_init(RclClientInit::StdFuncT record)
{
assert(rcl_client_init_.get() != nullptr);
Expand Down Expand Up @@ -432,6 +471,20 @@ bool DataContainer::is_assigned_construct_static_executor() const
return callback_group_add_client_->is_assigned();
}

#ifdef ROS_DISTRO_JAZZY
bool DataContainer::is_assigned_callback_group_to_executor_entity_collector() const
{
assert(callback_group_to_executor_entity_collector_.get() != nullptr);
return callback_group_to_executor_entity_collector_->is_assigned();
}

bool DataContainer::is_assigned_executor_entity_collector_to_executor() const
{
assert(executor_entity_collector_to_executor_.get() != nullptr);
return executor_entity_collector_to_executor_->is_assigned();
}
#endif

bool DataContainer::is_assigned_rcl_client_init() const
{
assert(rcl_client_init_.get() != nullptr);
Expand Down
Loading
Loading