diff --git a/tracetools/include/tracetools/tp_call.h b/tracetools/include/tracetools/tp_call.h index c1a6351..23c423c 100644 --- a/tracetools/include/tracetools/tp_call.h +++ b/tracetools/include/tracetools/tp_call.h @@ -26,6 +26,9 @@ #if !defined(_TRACETOOLS__TP_CALL_H_) || defined(TRACEPOINT_HEADER_MULTI_READ) #define _TRACETOOLS__TP_CALL_H_ +/// See RMW_GID_STORAGE_SIZE in rmw. +#define TRACETOOLS_GID_STORAGE_SIZE 16u + #include #include @@ -79,6 +82,379 @@ TRACEPOINT_EVENT( ) ) +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rcl_publish, + TP_ARGS( + const void *, publisher_handle_arg, + const void *, message_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, publisher_handle, publisher_handle_arg) + ctf_integer_hex(const void *, message, message_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_publish, + TP_ARGS( + const void *, publisher_handle_arg, + const void *, message_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, publisher_handle, publisher_handle_arg) + ctf_integer_hex(const void *, message, message_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_executor_execute, + TP_ARGS( + const void *, handle_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, handle, handle_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_executor_wait_for_work, + TP_ARGS( + const int64_t, timeout_arg + ), + TP_FIELDS( + ctf_integer(int64_t, timeout, timeout_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_take, + TP_ARGS( + const void *, message_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, message, message_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_executor_get_next_ready, + TP_ARGS(), + TP_FIELDS() +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rmw_take, + TP_ARGS( + const void *, rmw_subscription_handle_arg, + const void *, message_arg, + int64_t, source_timestamp_arg, + const bool, taken_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, rmw_subscription_handle, rmw_subscription_handle_arg) + ctf_integer_hex(const void *, message, message_arg) + ctf_integer(int64_t, source_timestamp, source_timestamp_arg) + ctf_integer(int, taken, (taken_arg ? 1 : 0)) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rmw_publish, + TP_ARGS( + const void *, rmw_publisher_handle_arg, + const void *, message_arg, + int64_t, 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(int64_t, timestamp, timestamp_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rmw_publisher_init, + TP_ARGS( + const void *, rmw_publisher_handle_arg, + const uint8_t *, gid_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, rmw_publisher_handle, rmw_publisher_handle_arg) + ctf_array(uint8_t, gid, gid_arg, TRACETOOLS_GID_STORAGE_SIZE) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rmw_client_init, + TP_ARGS( + const void *, rmw_client_handle_arg, + const uint8_t *, gid_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, rmw_client_handle, rmw_client_handle_arg) + ctf_array(uint8_t, gid, gid_arg, TRACETOOLS_GID_STORAGE_SIZE) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rmw_subscription_init, + TP_ARGS( + const void *, rmw_subscription_handle_arg, + const uint8_t *, gid_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, rmw_subscription_handle, rmw_subscription_handle_arg) + ctf_array(uint8_t, gid, gid_arg, TRACETOOLS_GID_STORAGE_SIZE) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rmw_take_response, + TP_ARGS( + const void *, rmw_client_handle_arg, + const void *, response_arg, + int64_t, sequence_number_arg, + int64_t, source_timestamp_arg, + const bool, taken_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, rmw_client_handle, rmw_client_handle_arg) + ctf_integer_hex(const void *, response, response_arg) + ctf_integer(int64_t, sequence_number, sequence_number_arg) + ctf_integer(int64_t, source_timestamp, source_timestamp_arg) + ctf_integer(int, taken, (taken_arg ? 1 : 0)) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rmw_take_request, + TP_ARGS( + const void *, rmw_service_handle_arg, + const void *, request_arg, + const uint8_t *, client_gid_arg, + int64_t, sequence_number_arg, + const bool, taken_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, rmw_service_handle, rmw_service_handle_arg) + ctf_integer_hex(const void *, request, request_arg) + ctf_array(uint8_t, client_gid, client_gid_arg, TRACETOOLS_GID_STORAGE_SIZE) + ctf_integer(int64_t, sequence_number, sequence_number_arg) + ctf_integer(int, taken, (taken_arg ? 1 : 0)) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rmw_send_response, + TP_ARGS( + const void *, rmw_service_handle_arg, + const void *, response_arg, + const uint8_t *, client_gid_arg, + int64_t, sequence_number_arg, + int64_t, timestamp_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, rmw_service_handle, rmw_service_handle_arg) + ctf_integer_hex(const void *, response, response_arg) + ctf_array(uint8_t, client_gid, client_gid_arg, TRACETOOLS_GID_STORAGE_SIZE) + ctf_integer(int64_t, sequence_number, sequence_number_arg) + ctf_integer(int64_t, timestamp, timestamp_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rmw_send_request, + TP_ARGS( + const void *, rmw_client_handle_arg, + const void *, request_arg, + int64_t, sequence_number_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, rmw_client_handle, rmw_client_handle_arg) + ctf_integer_hex(const void *, request, request_arg) + ctf_integer(int64_t, sequence_number, sequence_number_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rcl_take, + TP_ARGS( + const void *, message_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, message, message_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_intra_publish, + TP_ARGS( + const void *, publisher_handle_arg, + const void *, message_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, publisher_handle, publisher_handle_arg) + ctf_integer_hex(const void *, message, message_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_ring_buffer_clear, + TP_ARGS( + const void *, buffer_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, buffer, buffer_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_ring_buffer_dequeue, + TP_ARGS( + const void *, buffer_arg, + const uint64_t, index_arg, + const uint64_t, size_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, buffer, buffer_arg) + ctf_integer(const uint64_t, index, index_arg) + ctf_integer(const uint64_t, size, size_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_buffer_to_ipb, + TP_ARGS( + const void *, buffer_arg, + const void *, ipb_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, buffer, buffer_arg) + ctf_integer_hex(const void *, ipb, ipb_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_construct_ring_buffer, + TP_ARGS( + const void *, buffer_arg, + const uint64_t, capacity_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, buffer, buffer_arg) + ctf_integer(const uint64_t, capacity, capacity_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_ring_buffer_enqueue, + TP_ARGS( + const void *, buffer_arg, + const uint64_t, index_arg, + const uint64_t, size_arg, + const bool, overwritten_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, buffer, buffer_arg) + ctf_integer(const uint64_t, index, index_arg) + ctf_integer(const uint64_t, size, size_arg) + ctf_integer(const int, overwritten, (overwritten_arg ? 1 : 0)) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + message_link_periodic_async, + TP_ARGS( + const void **, subs_arg, + const size_t, num_subs_arg, + const void **, pubs_arg, + const size_t, num_pubs_arg + ), + TP_FIELDS( + ctf_sequence_hex(const void *, subs, subs_arg, size_t, num_subs_arg) + ctf_sequence_hex(const void *, pubs, pubs_arg, size_t, num_pubs_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + message_link_partial_sync, + TP_ARGS( + const void **, subs_arg, + const size_t, num_subs_arg, + const void **, pubs_arg, + const size_t, num_pubs_arg + ), + TP_FIELDS( + ctf_sequence_hex(const void *, subs, subs_arg, size_t, num_subs_arg) + ctf_sequence_hex(const void *, pubs, pubs_arg, size_t, num_pubs_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rclcpp_timer_link_node, + TP_ARGS( + const void *, timer_handle_arg, + const void *, node_handle_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, timer_handle, timer_handle_arg) + ctf_integer_hex(const void *, node_handle, node_handle_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rcl_lifecycle_transition, + TP_ARGS( + const void *, state_machine_arg, + const char *, start_label_arg, + const char *, goal_label_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, state_machine, state_machine_arg) + ctf_string(start_label, start_label_arg) + ctf_string(goal_label, goal_label_arg) + ) +) + +TRACEPOINT_EVENT( + TRACEPOINT_PROVIDER, + rcl_lifecycle_state_machine_init, + TP_ARGS( + const void *, node_handle_arg, + const void *, state_machine_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, node_handle, node_handle_arg) + ctf_integer_hex(const void *, state_machine, state_machine_arg) + ) +) + TRACEPOINT_EVENT( TRACEPOINT_PROVIDER, rcl_subscription_init, diff --git a/tracetools/include/tracetools/tracetools.h b/tracetools/include/tracetools/tracetools.h index 79dabb4..c91b294 100644 --- a/tracetools/include/tracetools/tracetools.h +++ b/tracetools/include/tracetools/tracetools.h @@ -39,13 +39,33 @@ */ # define TRACEPOINT(event_name, ...) \ (ros_trace_ ## event_name)(__VA_ARGS__) +# define TRACEPOINT_NOARGS(event_name) \ + (ros_trace_ ## event_name)() # define DECLARE_TRACEPOINT(event_name, ...) \ - TRACETOOLS_PUBLIC void ros_trace_ ## event_name(__VA_ARGS__); + TRACETOOLS_PUBLIC void ros_trace_ ## event_name(__VA_ARGS__); \ + TRACETOOLS_PUBLIC bool ros_trace_enabled_ ## event_name(); \ + TRACETOOLS_PUBLIC void ros_trace_do_ ## event_name(__VA_ARGS__); +# define DECLARE_TRACEPOINT_NOARGS(event_name) \ + TRACETOOLS_PUBLIC void ros_trace_ ## event_name(void); \ + TRACETOOLS_PUBLIC bool ros_trace_enabled_ ## event_name(); \ + TRACETOOLS_PUBLIC void ros_trace_do_ ## event_name(void); + #else # define TRACEPOINT(event_name, ...) ((void) (0)) # define DECLARE_TRACEPOINT(event_name, ...) #endif +/// Check if a tracepoint is enabled at runtime. +/** + * This can be useful to only compute tracepoint arguments if the tracepoint is actually enabled at + * runtime. Combine this with `DO_TRACEPOINT()` instead of `TRACEPOINT()` to trigger a tracepoint + * after checking if it is enabled and computing its arguments. + * + * This is the preferred method over calling the underlying function directly. + */ +# define TRACEPOINT_ENABLED(event_name) \ + ros_trace_enabled_ ## event_name() + #ifdef __cplusplus extern "C" { @@ -105,6 +125,409 @@ DECLARE_TRACEPOINT( const char * topic_name, const size_t queue_depth) +/// `rcl_publish` +/** + * Message publication. + * Links a `rcl_publisher_t` handle to a pointer to + * a message being published at the `rcl` level. + * + * \param[in] publisher_handle pointer to the publisher's `rcl_publisher_t` handle + * \param[in] message pointer to the message being published + */ +DECLARE_TRACEPOINT( + rcl_publish, + const void * publisher_handle, + const void * message) + +/// `rcl_init` +/** + * Initialisation for the whole process. + * Notes the `tracetools` version automatically. + * + * \param[in] context_handle pointer to the `rcl_context_t` handle + */ +DECLARE_TRACEPOINT( + rcl_init, + const void * context_handle) + +/// `rclcpp_publish` +/** + * Message publication. + * Links a `rcl_publisher_t` handle to a pointer to + * a message being published at the `rclcpp` level. + * + * \param[in] publisher_handle pointer to the publisher's `rcl_publisher_t` handle + * \param[in] message pointer to the message being published + */ + +DECLARE_TRACEPOINT( + rclcpp_publish, + const void * publisher_handle, + const void * message) + +/// `rclcpp_executor_execute` +/** + * Executable execution. + * Notes an executable being executed using its `rcl` handle, which can be a: + * * timer + * * subscription + * + * \param[in] handle pointer to the `rcl` handle of the executable being executed + */ +DECLARE_TRACEPOINT( + rclcpp_executor_execute, + const void * handle) + +/// `rclcpp_executor_wait_for_work` +/** + * Notes the start time of the executor phase that waits for work and notes the timeout value. + * + * \param[in] timeout the timeout value for the wait call + */ +DECLARE_TRACEPOINT( + rclcpp_executor_wait_for_work, + const int64_t timeout) + +/// `rclcpp_take` +/** + * Message taking. + * Notes the pointer to the message being taken at the `rclcpp` level. + * + * \param[in] message pointer to the message being taken + */ +DECLARE_TRACEPOINT( + rclcpp_take, + const void * message) + +/// `rclcpp_executor_get_next_ready` +/** + * Notes the start time of the executor phase that gets the next executable that's ready. + */ +DECLARE_TRACEPOINT_NOARGS( + rclcpp_executor_get_next_ready) + +/// `rmw_take` +/** + * Message taking. + * Links a `rmw_subscription_t` handle to a pointer to a message being taken at the `rmw` level. + * Notes the source timestamp of the message. + * + * \param[in] rmw_subscription_handle pointer to the subscription's `rmw_subscription_t` handle + * \param[in] message pointer to the message being taken + * \param[in] source_timestamp the source timestamp of the message, + * or 0 (if no message or no info) + * \param[in] taken whether a message was taken + */ +DECLARE_TRACEPOINT( + rmw_take, + const void * rmw_subscription_handle, + const void * message, + int64_t source_timestamp, + const bool taken) + +/// `rmw_publish` +/** + * Message publication. + * Notes the pointer to the message being published at the `rmw` level. + * Also notes the source timestamp of the message. + * + * \param[in] rmw_publisher_handle pointer to the publisher's `rmw_publisher_t` handle + * \param[in] message pointer to the message being published + * \param[in] timestamp the source timestamp of the message + */ +DECLARE_TRACEPOINT( + rmw_publish, + const void * rmw_publisher_handle, + const void * message, + int64_t timestamp) + +/// `rmw_publisher_init` +/** + * RMW publisher initialisation. + * Links a `rmw_publisher_t` handle to its DDS/rmw GID. + * + * \param[in] rmw_publisher_handle pointer to the publisher's `rmw_publisher_t` handle + * \param[in] gid pointer to the publisher's DDS/rmw GID + */ +DECLARE_TRACEPOINT( + rmw_publisher_init, + const void * rmw_publisher_handle, + const uint8_t * gid) + +/// `rmw_client_init` +/** + * RMW client initialisation. + * Links a `rmw_client_t` handle to its DDS/rmw GID. + * This GID should be the same client GID that is collected by the `rmw_take_request` and + * `rmw_send_response` tracepoints for requests made by this client and responses to requests made + * by this client. + * + * \param[in] rmw_client_handle pointer to the client's `rmw_client_t` handle + * \param[in] gid pointer to the client's DDS/rmw GID + */ +DECLARE_TRACEPOINT( + rmw_client_init, + const void * rmw_client_handle, + const uint8_t * gid) + +/// `rmw_subscription_init` +/** + * RMW subscription initialisation. + * Links a `rmw_subscription_handle` handle to its DDS/rmw GID. + * + * \param[in] rmw_subscription_handle pointer to the publisher's `rmw_subscription_t` handle + * \param[in] gid pointer to the subscription's DDS/rmw GID + */ +DECLARE_TRACEPOINT( + rmw_subscription_init, + const void * rmw_subscription_handle, + const uint8_t * gid) + +/// `rmw_take_response` +/** + * Response taking. + * Links a `rmw_client_t` handle to a pointer to a response being taken at the `rmw` level. + * Notes the source timestamp of the response. Also notes the sequence number of the request this + * response is for. It does not note the request's client GID, since it is assumed that the matching + * of the response to the original client is performed before this tracepoint. + * + * \param[in] rmw_client_handle pointer to the client's `rmw_client_t` handle + * \param[in] response pointer to the response being taken + * \param[in] sequence_number the sequence number of the request this response is for, + * or 0 (if no response or no info) + * \param[in] source_timestamp the source timestamp of the response, + * or 0 (if no response or no info) + * \param[in] taken whether a response was taken + */ +DECLARE_TRACEPOINT( + rmw_take_response, + const void * rmw_client_handle, + const void * response, + int64_t sequence_number, + int64_t source_timestamp, + const bool taken) + +/// `rmw_take_request` +/** + * Request taking. + * Links a `rmw_service_t` handle to a pointer to a request being taken at the `rmw` level. + * Also notes the sequence number of the request and the GID of the requesting client. + * + * \param[in] rmw_service_handle pointer to the service's `rmw_service_t` handle + * \param[in] request pointer to the request being taken + * \param[in] client_gid the GID of the requesting client + * \param[in] sequence_number the sequence number of the received request, + * or 0 (if no request or no info) + * \param[in] taken whether a request was taken + */ +DECLARE_TRACEPOINT( + rmw_take_request, + const void * rmw_service_handle, + const void * request, + const uint8_t * client_gid, + int64_t sequence_number, + const bool taken) + +/// `rmw_send_response` +/** + * Response publication. + * Notes the pointer to the response being sent at the `rmw` level. + * Also notes the sequence number of the request that this response is for and the GID of the + * requesting client, and notes the source timestamp of the response. + * + * \param[in] rmw_service_handle pointer to the service's `rmw_service_t` handle + * \param[in] response pointer to the request being sent + * \param[in] client_gid the GID of the requesting client + * \param[in] sequence_number the sequence number of the request this response is for + * \param[in] timestamp the source timestamp of the response + */ +DECLARE_TRACEPOINT( + rmw_send_response, + const void * rmw_service_handle, + const void * response, + const uint8_t * client_gid, + int64_t sequence_number, + int64_t timestamp) + +/// `rmw_send_request` +/** + * Request publication. + * Notes the pointer to the request being sent at the `rmw` level. + * Also notes the sequence number of the request. + * + * \param[in] rmw_client_handle pointer to the client's `rmw_client_t` handle + * \param[in] request pointer to the request being sent + * \param[in] sequence_number the sequence number of the request + */ +DECLARE_TRACEPOINT( + rmw_send_request, + const void * rmw_client_handle, + const void * request, + int64_t sequence_number) + +/// `rcl_take` +/** + * Message taking. + * Notes the pointer to the message being taken at the `rcl` level. + * + * \param[in] message pointer to the message being taken + */ +DECLARE_TRACEPOINT( + rcl_take, + const void * message) + +/// `rclcpp_intra_publish` +/** + * Intra-process message publication. + * Notes the pointer to the message being published in intra process at the `rclcpp` level. + * + * \param[in] publisher_handle pointer to the publisher's `rcl_publisher_t` handle + * \param[in] message pointer to the message being published + */ +DECLARE_TRACEPOINT( + rclcpp_intra_publish, + const void * publisher_handle, + const void * message) + +/// `rclcpp_ring_buffer_clear` +/** + * Ring buffer clear. + * Notes the address of the cleared buffer. + * + * \param[in] buffer pointer to the buffer + */ +DECLARE_TRACEPOINT( + rclcpp_ring_buffer_clear, + const void * buffer) + +/// `message_link_periodic_async` +/** + * Message link annotation for N-to-M link. + * + * \param[in] subs pointers to the `rcl` handles of the subscriptions in the link + * \param[in] num_subs the number of subscriptions in the link + * \param[in] pubs pointers to the `rcl` handles of the publishers in the link + * \param[in] num_pubs the number of publishers in the link + */ +DECLARE_TRACEPOINT( + message_link_periodic_async, + const void ** subs, + const size_t num_subs, + const void ** pubs, + const size_t num_pubs) + +/// `message_link_partial_sync` +/** + * Message link annotation for 2-to-M link. + * + * \param[in] subs pointers to the `rcl` handles of the subscriptions in the link + * \param[in] num_subs the number of subscriptions in the link + * \param[in] pubs pointers to the `rcl` handles of the publishers in the link + * \param[in] num_pubs the number of publishers in the link + */ +DECLARE_TRACEPOINT( + message_link_partial_sync, + const void ** subs, + const size_t num_subs, + const void ** pubs, + const size_t num_pubs) + +/// `rclcpp_ring_buffer_dequeue` +/** + * Ring buffer dequeue. + * Notes buffer address, the index to read from, and the size of the buffer after this operation. + * + * \param[in] buffer pointer to the buffer + * \param[in] index the index to read from + * \param[in] size the size of the buffer after this operation + */ +DECLARE_TRACEPOINT( + rclcpp_ring_buffer_dequeue, + const void * buffer, + const uint64_t index, + const uint64_t size) + +/// `rclcpp_buffer_to_ipb` +/** + * Intra-process buffer initialization. + * Notes the `BufferImplementationBase` and the `IntraProcessBuffer` that owns it. + * + * \param[in] buffer the pointer to the `BufferImplementationBase` + * \param[in] ipb to pointer to the `IntraProcessBuffer` + */ +DECLARE_TRACEPOINT( + rclcpp_buffer_to_ipb, + const void * buffer, + const void * ipb) + +/// `rclcpp_construct_ring_buffer` +/** + * Ring buffer construction. + * Notes the buffer address and its capacity. + * + * \param[in] buffer pointer to the buffer + * \param[in] capacity buffer size + */ +DECLARE_TRACEPOINT( + rclcpp_construct_ring_buffer, + const void * buffer, + const uint64_t capacity) + +/// `rclcpp_ring_buffer_enqueue` +/** + * Notes buffer address, the index to write to, and the occurrence of the lost. + * + * \param[in] buffer pointer to the buffer + * \param[in] index the index to write to + * \param[in] size the size of the buffer after this operation + * \param[in] overwritten occurrence of the lost + */ +DECLARE_TRACEPOINT( + rclcpp_ring_buffer_enqueue, + const void * buffer, + const uint64_t index, + const uint64_t size, + const bool overwritten) + +/// `rclcpp_timer_link_node` +/** + * Link a timer to a node. + * + * \param[in] timer_handle pointer to the timer's `rcl_timer_t` handle + * \param[in] node_handle pointer to the `rcl_node_t` handle of the node the timer belongs to + */ +DECLARE_TRACEPOINT( + rclcpp_timer_link_node, + const void * timer_handle, + const void * node_handle) + +/// `rcl_lifecycle_transition` +/** + * Lifecycle transition between two states. + * + * \param[in] state_machine pointer to the state machine for the transition + * \param[in] start_label start state label + * \param[in] goal_label goal state label + */ +DECLARE_TRACEPOINT( + rcl_lifecycle_transition, + const void * state_machine, + const char * start_label, + const char * goal_label) + +/// `rcl_lifecycle_state_machine_init` +/** + * Lifecycle state machine initialisation. + * Links a `rcl_lifecycle_state_machine_t` handle to a `rcl_node_t` handle. + * + * \param[in] node_handle pointer to the node handle + * \param[in] state_machine pointer to the state machine + */ +DECLARE_TRACEPOINT( + rcl_lifecycle_state_machine_init, + const void * node_handle, + const void * state_machine) + /// `rcl_subscription_init` /** * Subscription initialisation. diff --git a/tracetools/src/tracetools.c b/tracetools/src/tracetools.c index 4b3781e..129348a 100644 --- a/tracetools/src/tracetools.c +++ b/tracetools/src/tracetools.c @@ -82,6 +82,332 @@ void TRACEPOINT( queue_depth); } +void TRACEPOINT( + rcl_publish, + const void * publisher_handle, + const void * message) +{ + CONDITIONAL_TP( + rcl_publish, + publisher_handle, + message); +} + +void TRACEPOINT( + rmw_publish, + const void * rmw_publisher_handle, + const void * message, + int64_t timestamp) +{ + CONDITIONAL_TP( + rmw_publish, + rmw_publisher_handle, + message, + timestamp); +} + +void TRACEPOINT( + rmw_publisher_init, + const void * rmw_publisher_handle, + const uint8_t * gid) +{ + CONDITIONAL_TP( + rmw_publisher_init, + rmw_publisher_handle, + gid); +} + +void TRACEPOINT( + rclcpp_publish, + const void * publisher_handle, + const void * message) +{ + CONDITIONAL_TP( + rclcpp_publish, + publisher_handle, + message); +} + +void TRACEPOINT( + rclcpp_executor_execute, + const void * handle) +{ + CONDITIONAL_TP( + rclcpp_executor_execute, + handle); +} + +void TRACEPOINT( + rclcpp_executor_wait_for_work, + const int64_t timeout) +{ + CONDITIONAL_TP( + rclcpp_executor_wait_for_work, + timeout); +} + +void TRACEPOINT( + rclcpp_take, + const void * message) +{ + CONDITIONAL_TP( + rclcpp_take, + message); +} + +void TRACEPOINT_NOARGS( + rclcpp_executor_get_next_ready) +{ + CONDITIONAL_TP( + rclcpp_executor_get_next_ready); +} + +void TRACEPOINT( + rmw_take, + const void * rmw_subscription_handle, + const void * message, + int64_t source_timestamp, + const bool taken) +{ + CONDITIONAL_TP( + rmw_take, + rmw_subscription_handle, + message, + source_timestamp, + taken); +} + +void TRACEPOINT( + rmw_client_init, + const void * rmw_client_handle, + const uint8_t * gid) +{ + CONDITIONAL_TP( + rmw_client_init, + rmw_client_handle, + gid); +} + +void TRACEPOINT( + rmw_subscription_init, + const void * rmw_subscription_handle, + const uint8_t * gid) +{ + CONDITIONAL_TP( + rmw_subscription_init, + rmw_subscription_handle, + gid); +} + + +void TRACEPOINT( + rmw_take_response, + const void * rmw_client_handle, + const void * response, + int64_t sequence_number, + int64_t source_timestamp, + const bool taken) +{ + CONDITIONAL_TP( + rmw_take_response, + rmw_client_handle, + response, + sequence_number, + source_timestamp, + taken); +} + +void TRACEPOINT( + rmw_take_request, + const void * rmw_service_handle, + const void * request, + const uint8_t * client_gid, + int64_t sequence_number, + const bool taken) +{ + CONDITIONAL_TP( + rmw_take_request, + rmw_service_handle, + request, + client_gid, + sequence_number, + taken); +} + +void TRACEPOINT( + rmw_send_response, + const void * rmw_service_handle, + const void * response, + const uint8_t * client_gid, + int64_t sequence_number, + int64_t timestamp) +{ + CONDITIONAL_TP( + rmw_send_response, + rmw_service_handle, + response, + client_gid, + sequence_number, + timestamp); +} + +void TRACEPOINT( + rmw_send_request, + const void * rmw_client_handle, + const void * request, + int64_t sequence_numer) +{ + CONDITIONAL_TP( + rmw_send_request, + rmw_client_handle, + request, + sequence_numer); +} + +void TRACEPOINT( + rcl_take, + const void * message) +{ + CONDITIONAL_TP( + rcl_take, + message); +} + +void TRACEPOINT( + rclcpp_intra_publish, + const void * publisher_handle, + const void * message) +{ + CONDITIONAL_TP( + rclcpp_intra_publish, + publisher_handle, + message); +} + +void TRACEPOINT( + message_link_periodic_async, + const void ** subs, + const size_t num_subs, + const void ** pubs, + const size_t num_pubs) +{ + CONDITIONAL_TP( + message_link_periodic_async, + subs, + num_subs, + pubs, + num_pubs); +} + +void TRACEPOINT( + message_link_partial_sync, + const void ** subs, + const size_t num_subs, + const void ** pubs, + const size_t num_pubs) +{ + CONDITIONAL_TP( + message_link_partial_sync, + subs, + num_subs, + pubs, + num_pubs); +} + +void TRACEPOINT( + rclcpp_ring_buffer_clear, + const void * buffer) +{ + CONDITIONAL_TP( + rclcpp_ring_buffer_clear, + buffer); +} + +void TRACEPOINT( + rclcpp_ring_buffer_dequeue, + const void * buffer, + const uint64_t index, + const uint64_t size) +{ + CONDITIONAL_TP( + rclcpp_ring_buffer_dequeue, + buffer, + index, + size); +} + +void TRACEPOINT( + rclcpp_buffer_to_ipb, + const void * buffer, + const void * ipb) +{ + CONDITIONAL_TP( + rclcpp_buffer_to_ipb, + buffer, + ipb); +} + +void TRACEPOINT( + rclcpp_construct_ring_buffer, + const void * buffer, + const uint64_t capacity) +{ + CONDITIONAL_TP( + rclcpp_construct_ring_buffer, + buffer, + capacity); +} + +void TRACEPOINT( + rclcpp_ring_buffer_enqueue, + const void * buffer, + const uint64_t index, + const uint64_t size, + const bool overwritten) +{ + CONDITIONAL_TP( + rclcpp_ring_buffer_enqueue, + buffer, + index, + size, + overwritten); +} + +void TRACEPOINT( + rclcpp_timer_link_node, + const void * timer_handle, + const void * node_handle) +{ + CONDITIONAL_TP( + rclcpp_timer_link_node, + timer_handle, + node_handle); +} + +void TRACEPOINT( + rcl_lifecycle_transition, + const void * state_machine, + const char * start_label, + const char * goal_label) +{ + CONDITIONAL_TP( + rcl_lifecycle_transition, + state_machine, + start_label, + goal_label); +} + +void TRACEPOINT( + rcl_lifecycle_state_machine_init, + const void * node_handle, + const void * state_machine) +{ + CONDITIONAL_TP( + rcl_lifecycle_state_machine_init, + node_handle, + state_machine); +} + void TRACEPOINT( rcl_subscription_init, const void * subscription_handle, diff --git a/tracetools_trace/tracetools_trace/tools/names.py b/tracetools_trace/tracetools_trace/tools/names.py index 2750190..2f46a83 100644 --- a/tracetools_trace/tracetools_trace/tools/names.py +++ b/tracetools_trace/tracetools_trace/tools/names.py @@ -62,6 +62,8 @@ DEFAULT_EVENTS_ROS = [ 'ros2:rcl_init', 'ros2:rcl_node_init', 'ros2:rcl_publisher_init', + 'ros2:rcl_publish', + 'ros2:rclcpp_publish', 'ros2:rcl_subscription_init', 'ros2:rclcpp_subscription_init', 'ros2:rclcpp_subscription_callback_added',