Skip to content

Commit

Permalink
ci(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Apr 12, 2024
1 parent 44ed3a5 commit ccb8fda
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 138 deletions.
3 changes: 2 additions & 1 deletion CARET_trace/include/caret_trace/data_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class DataContainer : public DataContainerInterface
{
public:
/// @brief for add_callback_group trace points.
using AddCallbackGroup = ContainerTraits<const void *, const void *, const char *, const void *, int64_t>;
using AddCallbackGroup =
ContainerTraits<const void *, const void *, const char *, const void *, int64_t>;

/// @brief ContainerTraits for add_callback_group_static_executor trace points.
using AddCallbackGroupStaticExecutor =
Expand Down
8 changes: 4 additions & 4 deletions CARET_trace/include/caret_trace/tracing_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class TracingController
void add_node(const void * node_handle, std::string node_name);

std::string get_node_name(const std::string type, const void * key);

/// @brief Register topic name for rcl_subscription_init hook.
/// @param node_handle Address of the node handle.
/// @param subscription_handle Address of the subscription handle.
Expand Down Expand Up @@ -222,15 +222,15 @@ class TracingController
std::unordered_map<const void *, const void *> ipb_to_subscriptions_;
std::unordered_map<const void *, bool> allowed_buffers_;
std::unordered_map<const void *, bool> allowed_ipbs_;

std::unordered_map<const void *, const void *> state_machine_to_node_handles_;
std::unordered_map<const void *, bool> allowed_state_machines_;

std::unordered_map<const void *, const void *> service_handle_to_node_handles_;
std::unordered_map<const void *, bool> allowed_service_handle_;
std::unordered_map<const void *, const void *> client_handle_to_node_handles_;
std::unordered_map<const void *, bool> allowed_client_handles_;

std::unordered_map<const void *, const void *> message_to_publisher_handles_;
std::unordered_map<const void *, bool> allowed_messages_;
};
Expand Down
70 changes: 38 additions & 32 deletions CARET_trace/src/hooked_trace_points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,9 @@ int dds_writecdr_impl(void * wr, void * xp, struct ddsi_serdata * dinp, bool flu
tracepoint(
TRACEPOINT_PROVIDER, dds_bind_addr_to_stamp, serialized_message_addr, dinp->timestamp.v);
#ifdef DEBUG_OUTPUT
//std::cerr << "dds_bind_addr_to_stamp," << data << "," << tstamp << std::endl;
std::cerr << "dds_bind_addr_to_stamp," << serialized_message_addr << "," << dinp->timestamp.v << std::endl;
// std::cerr << "dds_bind_addr_to_stamp," << data << "," << tstamp << std::endl;
std::cerr << "dds_bind_addr_to_stamp," << serialized_message_addr << "," << dinp->timestamp.v
<< std::endl;
#endif
}
return dds_return;
Expand Down Expand Up @@ -439,30 +440,33 @@ void SYMBOL_CONCAT_3(
_ZN6rclcpp8Executor25add_callback_group_to_map,
ESt10shared_ptrINS_13CallbackGroupEES1_INS_15node_interfaces17NodeBaseInterface,
EERSt3mapISt8weak_ptrIS2_ES8_IS5_ESt10owner_lessIS9_ESaISt4pairIKS9_SA_EEEb)(
void * obj, rclcpp::CallbackGroup::SharedPtr group_ptr, rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr,
const void * weak_groups_to_nodes, bool notify)
void * obj, rclcpp::CallbackGroup::SharedPtr group_ptr,
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, const void * weak_groups_to_nodes,
bool notify)
{
static void * orig_func = dlsym(RTLD_NEXT, __func__);
static auto & context = Singleton<Context>::get_instance();
static auto & clock = context.get_clock();
static auto & data_container = context.get_data_container();
static auto record =
[](const void * obj, const void * group_addr, const char * group_type_name, const void * node_handle, int64_t init_time) {
if (!context.get_controller().is_allowed_node(node_handle)) {
return;
}
tracepoint(
TRACEPOINT_PROVIDER, add_callback_group, obj, group_addr, group_type_name, init_time);
static auto record = [](
const void * obj, const void * group_addr, const char * group_type_name,
const void * node_handle, int64_t init_time) {
if (!context.get_controller().is_allowed_node(node_handle)) {
return;
}
tracepoint(
TRACEPOINT_PROVIDER, add_callback_group, obj, group_addr, group_type_name, init_time);

#ifdef DEBUG_OUTPUT
std::cerr << "add_callback_group," << obj << "," << group_addr << "," << group_type_name
<< std::endl;
std::cerr << "add_callback_group," << obj << "," << group_addr << "," << group_type_name
<< std::endl;
#endif
};
};
auto now = clock.now();

using functionT =
void (*)(void *, rclcpp::CallbackGroup::SharedPtr, rclcpp::node_interfaces::NodeBaseInterface::SharedPtr, const void *, bool);
using functionT = void (*)(
void *, rclcpp::CallbackGroup::SharedPtr, rclcpp::node_interfaces::NodeBaseInterface::SharedPtr,
const void *, bool);
auto group_addr = static_cast<const void *>(group_ptr.get());
auto node_addr = static_cast<const void *>(node_ptr.get());

Expand Down Expand Up @@ -490,7 +494,8 @@ void SYMBOL_CONCAT_3(
}

auto node_handle = static_cast<const void *>(node_ptr->get_rcl_node_handle());
data_container.store_add_callback_group(obj, group_addr, group_type_name.c_str(), node_handle, now);
data_container.store_add_callback_group(
obj, group_addr, group_type_name.c_str(), node_handle, now);
if (!recorded_args.has(obj, group_addr_, node_addr_)) {
recorded_args.insert(obj, group_addr_, node_addr_);

Expand All @@ -513,20 +518,21 @@ bool SYMBOL_CONCAT_3(
static auto & context = Singleton<Context>::get_instance();
static auto & clock = context.get_clock();
static auto & data_container = context.get_data_container();
static auto record =
[](const void * obj, const void * group_addr, const char * group_type_name, const void * node_handle, int64_t init_time) {
if (!context.get_controller().is_allowed_node(node_handle)) {
return;
}
tracepoint(
TRACEPOINT_PROVIDER, add_callback_group_static_executor, obj, group_addr, group_type_name,
init_time);
static auto record = [](
const void * obj, const void * group_addr, const char * group_type_name,
const void * node_handle, int64_t init_time) {
if (!context.get_controller().is_allowed_node(node_handle)) {
return;
}
tracepoint(
TRACEPOINT_PROVIDER, add_callback_group_static_executor, obj, group_addr, group_type_name,
init_time);

#ifdef DEBUG_OUTPUT
std::cerr << "add_callback_group_static_executor," << obj << "," << group_addr << ","
<< group_type_name << std::endl;
std::cerr << "add_callback_group_static_executor," << obj << "," << group_addr << ","
<< group_type_name << std::endl;
#endif
};
};

auto now = clock.now();
auto group_addr = static_cast<const void *>(group_ptr.get());
Expand Down Expand Up @@ -580,7 +586,7 @@ void _ZN6rclcpp13CallbackGroup9add_timerESt10shared_ptrINS_9TimerBaseEE(
auto now = clock.now();
auto timer_handle = static_cast<const void *>(timer_ptr->get_timer_handle().get());
((functionT)orig_func)(obj, timer_ptr);

if (!context.get_controller().is_allowed_process()) {
return;
}
Expand Down Expand Up @@ -619,7 +625,7 @@ void _ZN6rclcpp13CallbackGroup16add_subscriptionESt10shared_ptrINS_16Subscriptio
auto subscription_handle =
static_cast<const void *>(subscription_ptr->get_subscription_handle().get());
((functionT)orig_func)(obj, subscription_ptr);

if (!context.get_controller().is_allowed_process()) {
return;
}
Expand Down Expand Up @@ -655,7 +661,7 @@ void _ZN6rclcpp13CallbackGroup11add_serviceESt10shared_ptrINS_11ServiceBaseEE(
auto now = clock.now();
auto service_handle = static_cast<const void *>(service_ptr->get_service_handle().get());
((functionT)orig_func)(obj, service_ptr);

if (!context.get_controller().is_allowed_process()) {
return;
}
Expand Down Expand Up @@ -691,7 +697,7 @@ void _ZN6rclcpp13CallbackGroup10add_clientESt10shared_ptrINS_10ClientBaseEE(
auto now = clock.now();
auto client_handle = static_cast<const void *>(client_ptr->get_client_handle().get());
((functionT)orig_func)(obj, client_ptr);

if (!context.get_controller().is_allowed_process()) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion CARET_trace/src/ros_trace_points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ void ros_trace_rcl_lifecycle_transition(
return;
}

if (context.get_controller().is_allowed_state_machine(state_machine) &&
if (context.get_controller().is_allowed_state_machine(state_machine) &&
context.is_recording_allowed()) {
((functionT) orig_func)(state_machine, start_label, goal_label);

Expand Down
Loading

0 comments on commit ccb8fda

Please sign in to comment.