Skip to content

Commit

Permalink
feat: add tracepoints definition compatible to caret v0.2
Browse files Browse the repository at this point in the history
Signed-off-by: hsgwa <[email protected]>
  • Loading branch information
hsgwa committed Jun 16, 2022
1 parent 638fa0a commit 43f23b7
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 5 deletions.
66 changes: 65 additions & 1 deletion tracetools/include/tracetools/tp_call.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,14 @@ TRACEPOINT_EVENT(
TRACEPOINT_PROVIDER,
rclcpp_publish,
TP_ARGS(
const void *, message_arg
const void *, publisher_handle_arg,
const void *, message_arg,
const uint64_t, message_timestamp_arg
),
TP_FIELDS(
ctf_integer_hex(const void *, publisher_handle, publisher_handle_arg)
ctf_integer_hex(const void *, message, message_arg)
ctf_integer(const uint64_t, message_timestamp, message_timestamp_arg)
)
)

Expand Down Expand Up @@ -408,6 +412,66 @@ TRACEPOINT_EVENT(
)
)

TRACEPOINT_EVENT(
TRACEPOINT_PROVIDER,
message_construct,
TP_ARGS(
const void *, original_message_arg,
const void *, constructed_message_arg
),
TP_FIELDS(
ctf_integer_hex(const void *, original_message, original_message_arg)
ctf_integer_hex(const void *, constructed_message, constructed_message_arg)
)
)

TRACEPOINT_EVENT(
TRACEPOINT_PROVIDER,
rclcpp_intra_publish,
TP_ARGS(
const void *, publisher_handle_arg,
const void *, message_arg,
const uint64_t, message_timestamp_arg
),
TP_FIELDS(
ctf_integer_hex(const void *, publisher_handle, publisher_handle_arg)
ctf_integer_hex(const void *, message, message_arg)
ctf_integer(const uint64_t, message_timestamp, message_timestamp_arg)
)
)

TRACEPOINT_EVENT(
TRACEPOINT_PROVIDER,
dispatch_subscription_callback,
TP_ARGS(
const void *, message_arg,
const void *, callback_arg,
const uint64_t, source_timestamp_arg,
const uint64_t, message_timestamp_arg
),
TP_FIELDS(
ctf_integer_hex(const void *, message, message_arg)
ctf_integer_hex(const void *, callback, callback_arg)
ctf_integer(const uint64_t, source_stamp, source_timestamp_arg)
ctf_integer(const uint64_t, message_timestamp, message_timestamp_arg)
)
)

TRACEPOINT_EVENT(
TRACEPOINT_PROVIDER,
dispatch_intra_process_subscription_callback,
TP_ARGS(
const void *, message_arg,
const void *, callback_arg,
const uint64_t, message_timestamp_arg
),
TP_FIELDS(
ctf_integer_hex(const void *, message, message_arg)
ctf_integer_hex(const void *, callback, callback_arg)
ctf_integer(const uint64_t, message_timestamp, message_timestamp_arg)
)
)

#endif // _TRACETOOLS__TP_CALL_H_

#include <lttng/tracepoint-event.h>
Expand Down
28 changes: 27 additions & 1 deletion tracetools/include/tracetools/tracetools.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,13 @@ DECLARE_TRACEPOINT(
*
* \param[in] publisher_handle not used, but kept for API/ABI stability
* \param[in] message pointer to the message being published
* \param[in] timestamp of message header
*/
DECLARE_TRACEPOINT(
rclcpp_publish,
const void * publisher_handle,
const void * message)
const void * message,
const uint64_t message_timestamp)

/// `rcl_publish`
/**
Expand Down Expand Up @@ -482,6 +484,30 @@ DECLARE_TRACEPOINT(
rclcpp_executor_execute,
const void * handle)

DECLARE_TRACEPOINT(
message_construct,
const void * original_message,
const void * constructed_message)

DECLARE_TRACEPOINT(
rclcpp_intra_publish,
const void * publisher_handle,
const void * message,
const uint64_t message_timestamp)

DECLARE_TRACEPOINT(
dispatch_subscription_callback,
const void * message,
const void * callback,
const uint64_t source_timestamp,
const uint64_t message_timestamp)

DECLARE_TRACEPOINT(
dispatch_intra_process_subscription_callback,
const void * message,
const void * callback,
const uint64_t message_timestamp)

#ifdef __cplusplus
}
#endif
Expand Down
61 changes: 58 additions & 3 deletions tracetools/src/tracetools.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ void TRACEPOINT(
void TRACEPOINT(
rclcpp_publish,
const void * publisher_handle,
const void * message)
const void * message,
const uint64_t message_timestamp)
{
(void)publisher_handle;
CONDITIONAL_TP(
rclcpp_publish,
message);
publisher_handle,
message,
message_timestamp);
}

void TRACEPOINT(
Expand Down Expand Up @@ -362,6 +364,59 @@ void TRACEPOINT(
handle);
}

void TRACEPOINT(
message_construct,
const void * original_message,
const void * constructed_message)
{
CONDITIONAL_TP(
message_construct,
original_message,
constructed_message);
}

void TRACEPOINT(
rclcpp_intra_publish,
const void * publisher_handle,
const void * message,
const uint64_t message_timestamp
)
{
CONDITIONAL_TP(
rclcpp_intra_publish,
publisher_handle,
message,
message_timestamp);
}

void TRACEPOINT(
dispatch_subscription_callback,
const void * message,
const void * callback,
const uint64_t source_stamp,
const uint64_t message_timestamp)
{
CONDITIONAL_TP(
dispatch_subscription_callback,
message,
callback,
source_stamp,
message_timestamp);
}

void TRACEPOINT(
dispatch_intra_process_subscription_callback,
const void * message,
const void * callback,
const uint64_t message_timestamp)
{
CONDITIONAL_TP(
dispatch_intra_process_subscription_callback,
message,
callback,
message_timestamp);
}

#ifndef _WIN32
# pragma GCC diagnostic pop
#else
Expand Down

0 comments on commit 43f23b7

Please sign in to comment.