diff --git a/tracetools/.gitignore b/tracetools/.gitignore index ff6c930..a9f1530 100644 --- a/tracetools/.gitignore +++ b/tracetools/.gitignore @@ -1 +1,5 @@ traces/ + +# generated files (LTTng) +tp_call.c +tp_call.h diff --git a/tracetools/CMakeLists.txt b/tracetools/CMakeLists.txt index cc9f735..f5f38cc 100644 --- a/tracetools/CMakeLists.txt +++ b/tracetools/CMakeLists.txt @@ -21,13 +21,13 @@ endif() if(LTTNG_FOUND) # Generate necessary LTTng files # If successful, enable tracing - add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/src/tp_call.c - COMMAND lttng-gen-tp tp_call.tp -o ../src/tp_call.c -o ../src/tp_call.h - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/lttng - DEPENDS ${PROJECT_SOURCE_DIR}/lttng/tp_call.tp + add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/src/tp_call.c ${PROJECT_SOURCE_DIR}/include/tp_call.h + COMMAND lttng-gen-tp tp_call.tp -o tp_call.c -o ../include/tp_call.h + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src + DEPENDS ${PROJECT_SOURCE_DIR}/src/tp_call.tp ) set(LTTNG_GENERATED - src/tp_call.h + include/tp_call.h src/tp_call.c ) set(TRACING_ENABLED TRUE) diff --git a/tracetools/include/tracetools/tracetools.h b/tracetools/include/tracetools/tracetools.h index 944e6ce..bc4c018 100644 --- a/tracetools/include/tracetools/tracetools.h +++ b/tracetools/include/tracetools/tracetools.h @@ -1,12 +1,12 @@ -#ifndef __TRACETOOLS_TRACETOOLS_H_ -#define __TRACETOOLS_TRACETOOLS_H_ +#ifndef TRACETOOLS__TRACETOOLS_H_ +#define TRACETOOLS__TRACETOOLS_H_ #include #include #include #define TRACEPOINT(event_name, ...) \ - (ros_trace_##event_name)(__VA_ARGS__) + (ros_trace_ ## event_name)(__VA_ARGS__) #ifdef __cplusplus extern "C" @@ -128,7 +128,7 @@ void TRACEPOINT( void TRACEPOINT( rcl_timer_init, const void * timer_handle, - long period); + int64_t period); /** * tp: rclcpp_timer_callback_added @@ -164,4 +164,4 @@ void TRACEPOINT( } #endif -#endif /* __TRACETOOLS_TRACETOOLS_H_ */ +#endif /* TRACETOOLS__TRACETOOLS_H_ */ diff --git a/tracetools/include/tracetools/utils.hpp b/tracetools/include/tracetools/utils.hpp index 70a06e0..d5b6377 100644 --- a/tracetools/include/tracetools/utils.hpp +++ b/tracetools/include/tracetools/utils.hpp @@ -1,19 +1,21 @@ -#ifndef __TRACETOOLS_UTILS_H_ -#define __TRACETOOLS_UTILS_H_ +#ifndef TRACETOOLS__UTILS_HPP_ +#define TRACETOOLS__UTILS_HPP_ #include +#include -template -size_t get_address(std::function f) { - typedef T(fnType)(U...); - fnType ** fnPointer = f.template target(); - // Might be a lambda - if (fnPointer == nullptr) { - return 0; - } - return (size_t)*fnPointer; +template +size_t get_address(std::function f) +{ + typedef T (fnType)(U...); + fnType ** fnPointer = f.template target(); + // Might be a lambda + if (fnPointer == nullptr) { + return 0; + } + return (size_t)*fnPointer; } const char * get_symbol(void * funptr); -#endif /* __TRACETOOLS_UTILS_H_ */ +#endif // TRACETOOLS__UTILS_HPP_ diff --git a/tracetools/lttng/tp_call.tp b/tracetools/lttng/tp_call.tp deleted file mode 100644 index 4a964cd..0000000 --- a/tracetools/lttng/tp_call.tp +++ /dev/null @@ -1,234 +0,0 @@ -#include - -TRACEPOINT_EVENT( - ros2, - rcl_init, - TP_ARGS( - const void *, context_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, context, context_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rcl_node_init, - TP_ARGS( - const void *, node_handle_arg, - const void *, rmw_handle_arg, - const char *, node_name_arg, - const char *, namespace_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, node_handle, node_handle_arg) - ctf_integer_hex(const void *, rmw_handle, rmw_handle_arg) - ctf_string(node_name, node_name_arg) - ctf_string(namespace, namespace_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rcl_publisher_init, - TP_ARGS( - const void *, node_handle_arg, - const void *, rmw_handle_arg, - const void *, publisher_handle_arg, - const char *, topic_name_arg, - const size_t, depth_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, node_handle, node_handle_arg) - ctf_integer_hex(const void *, rmw_handle, rmw_handle_arg) - ctf_integer_hex(const void *, publisher_handle, publisher_handle_arg) - ctf_string(topic_name, topic_name_arg) - ctf_integer(const size_t, depth, depth_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rcl_subscription_init, - TP_ARGS( - const void *, node_handle_arg, - const void *, subscription_handle_arg, - const void *, rmw_subscription_handle_arg, - const char *, topic_name_arg, - const size_t, depth_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, node_handle, node_handle_arg) - ctf_integer_hex(const void *, subscription_handle, subscription_handle_arg) - ctf_integer_hex(const void *, rmw_subscription_handle, rmw_subscription_handle_arg) - ctf_string(topic_name, topic_name_arg) - ctf_integer(const size_t, depth, depth_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rclcpp_subscription_callback_added, - TP_ARGS( - const void *, subscription_handle_arg, - const void *, callback_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, subscription_handle, subscription_handle_arg) - ctf_integer_hex(const void *, callback, callback_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rclcpp_subscription_callback_start, - TP_ARGS( - const void *, callback_arg, - int, is_intra_process_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, callback, callback_arg) - ctf_integer(int, is_intra_process, is_intra_process_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rclcpp_subscription_callback_end, - TP_ARGS( - const void *, callback_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, callback, callback_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rcl_service_init, - TP_ARGS( - const void *, node_handle_arg, - const void *, service_handle_arg, - const void *, rmw_service_handle_arg, - const char *, service_name_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, node_handle, node_handle_arg) - ctf_integer_hex(const void *, service_handle, service_handle_arg) - ctf_integer_hex(const void *, rmw_service_handle, rmw_service_handle_arg) - ctf_string(service_name, service_name_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rclcpp_service_callback_added, - TP_ARGS( - const void *, service_handle_arg, - const void *, callback_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, service_handle, service_handle_arg) - ctf_integer_hex(const void *, callback, callback_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rclcpp_service_callback_start, - TP_ARGS( - const void *, callback_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, callback, callback_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rclcpp_service_callback_end, - TP_ARGS( - const void *, callback_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, callback, callback_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rcl_client_init, - TP_ARGS( - const void *, node_handle_arg, - const void *, client_handle_arg, - const void *, rmw_client_handle_arg, - const char *, service_name_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, node_handle, node_handle_arg) - ctf_integer_hex(const void *, client_handle, client_handle_arg) - ctf_integer_hex(const void *, rmw_client_handle, rmw_client_handle_arg) - ctf_string(service_name, service_name_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rcl_timer_init, - TP_ARGS( - const void *, timer_handle_arg, - long, period_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, timer_handle, timer_handle_arg) - ctf_integer(long, period, period_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rclcpp_timer_callback_added, - TP_ARGS( - const void *, timer_handle_arg, - const void *, callback_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, timer_handle, timer_handle_arg) - ctf_integer_hex(const void *, callback, callback_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rclcpp_timer_callback_start, - TP_ARGS( - const void *, callback_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, callback, callback_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rclcpp_timer_callback_end, - TP_ARGS( - const void *, callback_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, callback, callback_arg) - ) -) - -TRACEPOINT_EVENT( - ros2, - rclcpp_callback_register, - TP_ARGS( - const void *, callback_arg, - const char *, symbol_arg - ), - TP_FIELDS( - ctf_integer_hex(const void *, callback, callback_arg) - ctf_string(symbol, symbol_arg) - ) -) diff --git a/tracetools/package.xml b/tracetools/package.xml index 14cc17c..f44f76f 100644 --- a/tracetools/package.xml +++ b/tracetools/package.xml @@ -5,9 +5,9 @@ 0.0.1 ROS 2 wrapper for instrumentation Christophe Bedard + APLv2 Ingo Luetkebohle Christophe Bedard - APLv2 ament_cmake pkg-config diff --git a/tracetools/src/.gitignore b/tracetools/src/.gitignore deleted file mode 100644 index 2b36a18..0000000 --- a/tracetools/src/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# generated files (LTTng) -tp_call.c -tp_call.h diff --git a/tracetools/src/tp_call.tp b/tracetools/src/tp_call.tp new file mode 100644 index 0000000..cf4ecac --- /dev/null +++ b/tracetools/src/tp_call.tp @@ -0,0 +1,234 @@ +#include + +TRACEPOINT_EVENT( + ros2, + rcl_init, + TP_ARGS( + const void *, context_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, context, context_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rcl_node_init, + TP_ARGS( + const void *, node_handle_arg, + const void *, rmw_handle_arg, + const char *, node_name_arg, + const char *, namespace_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, node_handle, node_handle_arg) + ctf_integer_hex(const void *, rmw_handle, rmw_handle_arg) + ctf_string(node_name, node_name_arg) + ctf_string(namespace, namespace_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rcl_publisher_init, + TP_ARGS( + const void *, node_handle_arg, + const void *, rmw_handle_arg, + const void *, publisher_handle_arg, + const char *, topic_name_arg, + const size_t, depth_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, node_handle, node_handle_arg) + ctf_integer_hex(const void *, rmw_handle, rmw_handle_arg) + ctf_integer_hex(const void *, publisher_handle, publisher_handle_arg) + ctf_string(topic_name, topic_name_arg) + ctf_integer(const size_t, depth, depth_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rcl_subscription_init, + TP_ARGS( + const void *, node_handle_arg, + const void *, subscription_handle_arg, + const void *, rmw_subscription_handle_arg, + const char *, topic_name_arg, + const size_t, depth_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, node_handle, node_handle_arg) + ctf_integer_hex(const void *, subscription_handle, subscription_handle_arg) + ctf_integer_hex(const void *, rmw_subscription_handle, rmw_subscription_handle_arg) + ctf_string(topic_name, topic_name_arg) + ctf_integer(const size_t, depth, depth_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rclcpp_subscription_callback_added, + TP_ARGS( + const void *, subscription_handle_arg, + const void *, callback_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, subscription_handle, subscription_handle_arg) + ctf_integer_hex(const void *, callback, callback_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rclcpp_subscription_callback_start, + TP_ARGS( + const void *, callback_arg, + int, is_intra_process_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, callback, callback_arg) + ctf_integer(int, is_intra_process, is_intra_process_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rclcpp_subscription_callback_end, + TP_ARGS( + const void *, callback_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, callback, callback_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rcl_service_init, + TP_ARGS( + const void *, node_handle_arg, + const void *, service_handle_arg, + const void *, rmw_service_handle_arg, + const char *, service_name_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, node_handle, node_handle_arg) + ctf_integer_hex(const void *, service_handle, service_handle_arg) + ctf_integer_hex(const void *, rmw_service_handle, rmw_service_handle_arg) + ctf_string(service_name, service_name_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rclcpp_service_callback_added, + TP_ARGS( + const void *, service_handle_arg, + const void *, callback_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, service_handle, service_handle_arg) + ctf_integer_hex(const void *, callback, callback_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rclcpp_service_callback_start, + TP_ARGS( + const void *, callback_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, callback, callback_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rclcpp_service_callback_end, + TP_ARGS( + const void *, callback_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, callback, callback_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rcl_client_init, + TP_ARGS( + const void *, node_handle_arg, + const void *, client_handle_arg, + const void *, rmw_client_handle_arg, + const char *, service_name_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, node_handle, node_handle_arg) + ctf_integer_hex(const void *, client_handle, client_handle_arg) + ctf_integer_hex(const void *, rmw_client_handle, rmw_client_handle_arg) + ctf_string(service_name, service_name_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rcl_timer_init, + TP_ARGS( + const void *, timer_handle_arg, + int64_t, period_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, timer_handle, timer_handle_arg) + ctf_integer(int64_t, period, period_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rclcpp_timer_callback_added, + TP_ARGS( + const void *, timer_handle_arg, + const void *, callback_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, timer_handle, timer_handle_arg) + ctf_integer_hex(const void *, callback, callback_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rclcpp_timer_callback_start, + TP_ARGS( + const void *, callback_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, callback, callback_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rclcpp_timer_callback_end, + TP_ARGS( + const void *, callback_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, callback, callback_arg) + ) +) + +TRACEPOINT_EVENT( + ros2, + rclcpp_callback_register, + TP_ARGS( + const void *, callback_arg, + const char *, symbol_arg + ), + TP_FIELDS( + ctf_integer_hex(const void *, callback, callback_arg) + ctf_string(symbol, symbol_arg) + ) +) diff --git a/tracetools/src/tracetools.c b/tracetools/src/tracetools.c index 1915333..d1063b2 100644 --- a/tracetools/src/tracetools.c +++ b/tracetools/src/tracetools.c @@ -3,7 +3,7 @@ #if defined(WITH_LTTNG) && !defined(_WIN32) # include "tp_call.h" # define CONDITIONAL_TP(...) \ - tracepoint(__VA_ARGS__) + tracepoint(__VA_ARGS__) #else # define CONDITIONAL_TP(...) #endif @@ -21,7 +21,10 @@ void TRACEPOINT( rcl_init, const void * context) { - CONDITIONAL_TP(ros2, rcl_init, context); + CONDITIONAL_TP( + ros2, + rcl_init, + context); } void TRACEPOINT( @@ -31,7 +34,13 @@ void TRACEPOINT( const char * node_name, const char * node_namespace) { - CONDITIONAL_TP(ros2, rcl_node_init, node_handle, rmw_handle, node_name, node_namespace); + CONDITIONAL_TP( + ros2, + rcl_node_init, + node_handle, + rmw_handle, + node_name, + node_namespace); } void TRACEPOINT( @@ -42,7 +51,14 @@ void TRACEPOINT( const char * topic_name, const size_t depth) { - CONDITIONAL_TP(ros2, rcl_publisher_init, node_handle, publisher_handle, rmw_publisher_handle, topic_name, depth); + CONDITIONAL_TP( + ros2, + rcl_publisher_init, + node_handle, + publisher_handle, + rmw_publisher_handle, + topic_name, + depth); } void TRACEPOINT( @@ -53,15 +69,26 @@ void TRACEPOINT( const char * topic_name, const size_t depth) { - CONDITIONAL_TP(ros2, rcl_subscription_init, node_handle, subscription_handle, rmw_subscription_handle, topic_name, depth); + CONDITIONAL_TP( + ros2, + rcl_subscription_init, + node_handle, + subscription_handle, + rmw_subscription_handle, + topic_name, + depth); } void TRACEPOINT( - rclcpp_subscription_callback_added, - const void * subscription_handle, - const void * callback) + rclcpp_subscription_callback_added, + const void * subscription_handle, + const void * callback) { - CONDITIONAL_TP(ros2, rclcpp_subscription_callback_added, subscription_handle, callback); + CONDITIONAL_TP( + ros2, + rclcpp_subscription_callback_added, + subscription_handle, + callback); } void TRACEPOINT( @@ -69,14 +96,21 @@ void TRACEPOINT( const void * callback, const bool is_intra_process) { - CONDITIONAL_TP(ros2, rclcpp_subscription_callback_start, callback, (is_intra_process ? 1 : 0)); + CONDITIONAL_TP( + ros2, + rclcpp_subscription_callback_start, + callback, + (is_intra_process ? 1 : 0)); } void TRACEPOINT( rclcpp_subscription_callback_end, const void * callback) { - CONDITIONAL_TP(ros2, rclcpp_subscription_callback_end, callback); + CONDITIONAL_TP( + ros2, + rclcpp_subscription_callback_end, + callback); } void TRACEPOINT( @@ -86,7 +120,13 @@ void TRACEPOINT( const void * rmw_service_handle, const char * service_name) { - CONDITIONAL_TP(ros2, rcl_service_init, node_handle, service_handle, rmw_service_handle, service_name); + CONDITIONAL_TP( + ros2, + rcl_service_init, + node_handle, + service_handle, + rmw_service_handle, + service_name); } void TRACEPOINT( @@ -94,21 +134,31 @@ void TRACEPOINT( const void * service_handle, const void * callback) { - CONDITIONAL_TP(ros2, rclcpp_service_callback_added, service_handle, callback); + CONDITIONAL_TP( + ros2, + rclcpp_service_callback_added, + service_handle, + callback); } void TRACEPOINT( rclcpp_service_callback_start, const void * callback) { - CONDITIONAL_TP(ros2, rclcpp_service_callback_start, callback); + CONDITIONAL_TP( + ros2, + rclcpp_service_callback_start, + callback); } void TRACEPOINT( rclcpp_service_callback_end, const void * callback) { - CONDITIONAL_TP(ros2, rclcpp_service_callback_end, callback); + CONDITIONAL_TP( + ros2, + rclcpp_service_callback_end, + callback); } void TRACEPOINT( @@ -118,15 +168,25 @@ void TRACEPOINT( const void * rmw_client_handle, const char * service_name) { - CONDITIONAL_TP(ros2, rcl_client_init, node_handle, client_handle, rmw_client_handle, service_name); + CONDITIONAL_TP( + ros2, + rcl_client_init, + node_handle, + client_handle, + rmw_client_handle, + service_name); } void TRACEPOINT( rcl_timer_init, const void * timer_handle, - long period) + int64_t period) { - CONDITIONAL_TP(ros2, rcl_timer_init, timer_handle, period); + CONDITIONAL_TP( + ros2, + rcl_timer_init, + timer_handle, + period); } void TRACEPOINT( @@ -134,21 +194,31 @@ void TRACEPOINT( const void * timer_handle, const void * callback) { - CONDITIONAL_TP(ros2, rclcpp_timer_callback_added, timer_handle, callback); + CONDITIONAL_TP( + ros2, + rclcpp_timer_callback_added, + timer_handle, + callback); } void TRACEPOINT( rclcpp_timer_callback_start, const void * callback) { - CONDITIONAL_TP(ros2, rclcpp_timer_callback_start, callback); + CONDITIONAL_TP( + ros2, + rclcpp_timer_callback_start, + callback); } void TRACEPOINT( rclcpp_timer_callback_end, const void * callback) { - CONDITIONAL_TP(ros2, rclcpp_timer_callback_end, callback); + CONDITIONAL_TP( + ros2, + rclcpp_timer_callback_end, + callback); } void TRACEPOINT( @@ -156,5 +226,9 @@ void TRACEPOINT( const void * callback, const char * function_symbol) { - CONDITIONAL_TP(ros2, rclcpp_callback_register, callback, function_symbol); + CONDITIONAL_TP( + ros2, + rclcpp_callback_register, + callback, + function_symbol); } diff --git a/tracetools/src/utils.cpp b/tracetools/src/utils.cpp index 56396de..8286bc5 100644 --- a/tracetools/src/utils.cpp +++ b/tracetools/src/utils.cpp @@ -2,26 +2,28 @@ #include #include #endif +#include "tracetools/utils.hpp" -const char * get_symbol(void * funptr) { +const char * get_symbol(void * funptr) +{ #define SYMBOL_UNKNOWN "UNKNOWN" #if defined(WITH_LTTNG) && !defined(_WIN32) #define SYMBOL_LAMBDA "[lambda]" - if (funptr == 0) { - return SYMBOL_LAMBDA; - } + if (funptr == 0) { + return SYMBOL_LAMBDA; + } - Dl_info info; - if (dladdr(funptr, &info) == 0) { - return SYMBOL_UNKNOWN; - } + Dl_info info; + if (dladdr(funptr, &info) == 0) { + return SYMBOL_UNKNOWN; + } - char * demangled = nullptr; - int status; - demangled = abi::__cxa_demangle(info.dli_sname, NULL, 0, &status); - // Use demangled symbol if possible - const char * demangled_val = (status == 0 ? demangled : info.dli_sname); - return (demangled_val != 0 ? demangled_val : SYMBOL_UNKNOWN); + char * demangled = nullptr; + int status; + demangled = abi::__cxa_demangle(info.dli_sname, NULL, 0, &status); + // Use demangled symbol if possible + const char * demangled_val = (status == 0 ? demangled : info.dli_sname); + return demangled_val != 0 ? demangled_val : SYMBOL_UNKNOWN; #else return SYMBOL_UNKNOWN; #endif diff --git a/tracetools_test/package.xml b/tracetools_test/package.xml index 622deb1..bfd77bf 100644 --- a/tracetools_test/package.xml +++ b/tracetools_test/package.xml @@ -5,8 +5,8 @@ 0.0.1 Separate test package for tracetools Christophe Bedard - Christophe Bedard APLv2 + Christophe Bedard ament_cmake pkg-config diff --git a/tracetools_test/src/test_ping.cpp b/tracetools_test/src/test_ping.cpp index 51eeab4..9491eda 100644 --- a/tracetools_test/src/test_ping.cpp +++ b/tracetools_test/src/test_ping.cpp @@ -6,56 +6,55 @@ using namespace std::chrono_literals; - class PingNode : public rclcpp::Node { public: - PingNode(rclcpp::NodeOptions options) : Node("ping_node", options) - { - sub_ = this->create_subscription( - "pong", - rclcpp::QoS(10), - std::bind(&PingNode::callback, this, std::placeholders::_1)); - pub_ = this->create_publisher( - "ping", - rclcpp::QoS(10)); - timer_ = this->create_wall_timer( - 500ms, - std::bind(&PingNode::timer_callback, this)); - } - + explicit PingNode(rclcpp::NodeOptions options) + : Node("ping_node", options) + { + sub_ = this->create_subscription( + "pong", + rclcpp::QoS(10), + std::bind(&PingNode::callback, this, std::placeholders::_1)); + pub_ = this->create_publisher( + "ping", + rclcpp::QoS(10)); + timer_ = this->create_wall_timer( + 500ms, + std::bind(&PingNode::timer_callback, this)); + } private: - void callback(const std_msgs::msg::String::SharedPtr msg) - { - RCLCPP_INFO(this->get_logger(), "[output] %s", msg->data.c_str()); - rclcpp::shutdown(); - } + void callback(const std_msgs::msg::String::SharedPtr msg) + { + RCLCPP_INFO(this->get_logger(), "[output] %s", msg->data.c_str()); + rclcpp::shutdown(); + } - void timer_callback() - { - auto msg = std::make_shared(); - msg->data = "some random ping string"; - pub_->publish(*msg); - } + void timer_callback() + { + auto msg = std::make_shared(); + msg->data = "some random ping string"; + pub_->publish(*msg); + } - rclcpp::Subscription::SharedPtr sub_; - rclcpp::Publisher::SharedPtr pub_; - rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Subscription::SharedPtr sub_; + rclcpp::Publisher::SharedPtr pub_; + rclcpp::TimerBase::SharedPtr timer_; }; -int main(int argc, char* argv[]) +int main(int argc, char * argv[]) { - rclcpp::init(argc, argv); + rclcpp::init(argc, argv); - rclcpp::executors::SingleThreadedExecutor exec; - auto ping_node = std::make_shared(rclcpp::NodeOptions()); - exec.add_node(ping_node); + rclcpp::executors::SingleThreadedExecutor exec; + auto ping_node = std::make_shared(rclcpp::NodeOptions()); + exec.add_node(ping_node); - printf("spinning\n"); - exec.spin(); + printf("spinning\n"); + exec.spin(); - // Will actually be called inside the node's callback - rclcpp::shutdown(); - return 0; + // Will actually be called inside the node's callback + rclcpp::shutdown(); + return 0; } diff --git a/tracetools_test/src/test_pong.cpp b/tracetools_test/src/test_pong.cpp index 99e35ce..4dc167b 100644 --- a/tracetools_test/src/test_pong.cpp +++ b/tracetools_test/src/test_pong.cpp @@ -3,47 +3,47 @@ #include "rclcpp/rclcpp.hpp" #include "std_msgs/msg/string.hpp" - class PongNode : public rclcpp::Node { public: - PongNode(rclcpp::NodeOptions options) : Node("pong_node", options) - { - sub_ = this->create_subscription( - "ping", - rclcpp::QoS(10), - std::bind(&PongNode::callback, this, std::placeholders::_1)); - pub_ = this->create_publisher( - "pong", - rclcpp::QoS(10)); - } + explicit PongNode(rclcpp::NodeOptions options) + : Node("pong_node", options) + { + sub_ = this->create_subscription( + "ping", + rclcpp::QoS(10), + std::bind(&PongNode::callback, this, std::placeholders::_1)); + pub_ = this->create_publisher( + "pong", + rclcpp::QoS(10)); + } private: - void callback(const std_msgs::msg::String::SharedPtr msg) - { - RCLCPP_INFO(this->get_logger(), "[output] %s", msg->data.c_str()); - auto next_msg = std::make_shared(); - next_msg->data = "some random pong string"; - pub_->publish(*next_msg); - rclcpp::shutdown(); - } + void callback(const std_msgs::msg::String::SharedPtr msg) + { + RCLCPP_INFO(this->get_logger(), "[output] %s", msg->data.c_str()); + auto next_msg = std::make_shared(); + next_msg->data = "some random pong string"; + pub_->publish(*next_msg); + rclcpp::shutdown(); + } - rclcpp::Subscription::SharedPtr sub_; - rclcpp::Publisher::SharedPtr pub_; + rclcpp::Subscription::SharedPtr sub_; + rclcpp::Publisher::SharedPtr pub_; }; -int main(int argc, char* argv[]) +int main(int argc, char * argv[]) { - rclcpp::init(argc, argv); + rclcpp::init(argc, argv); - rclcpp::executors::SingleThreadedExecutor exec; - auto pong_node = std::make_shared(rclcpp::NodeOptions()); - exec.add_node(pong_node); + rclcpp::executors::SingleThreadedExecutor exec; + auto pong_node = std::make_shared(rclcpp::NodeOptions()); + exec.add_node(pong_node); - printf("spinning\n"); - exec.spin(); + printf("spinning\n"); + exec.spin(); - // Will actually be called inside the node's callback - rclcpp::shutdown(); - return 0; + // Will actually be called inside the node's callback + rclcpp::shutdown(); + return 0; } diff --git a/tracetools_test/src/test_publisher.cpp b/tracetools_test/src/test_publisher.cpp index a12c30e..886e571 100644 --- a/tracetools_test/src/test_publisher.cpp +++ b/tracetools_test/src/test_publisher.cpp @@ -1,32 +1,34 @@ +#include + #include "rclcpp/rclcpp.hpp" #include "std_msgs/msg/string.hpp" - class PubNode : public rclcpp::Node { public: - PubNode(rclcpp::NodeOptions options) : Node("pub_node", options) - { - pub_ = this->create_publisher( - "the_topic", - rclcpp::QoS(10)); - } + explicit PubNode(rclcpp::NodeOptions options) + : Node("pub_node", options) + { + pub_ = this->create_publisher( + "the_topic", + rclcpp::QoS(10)); + } private: - rclcpp::Publisher::SharedPtr pub_; + rclcpp::Publisher::SharedPtr pub_; }; -int main(int argc, char* argv[]) +int main(int argc, char * argv[]) { - rclcpp::init(argc, argv); + rclcpp::init(argc, argv); - rclcpp::executors::SingleThreadedExecutor exec; - auto pub_node = std::make_shared(rclcpp::NodeOptions()); - exec.add_node(pub_node); + rclcpp::executors::SingleThreadedExecutor exec; + auto pub_node = std::make_shared(rclcpp::NodeOptions()); + exec.add_node(pub_node); - printf("spinning once\n"); - exec.spin_once(); + printf("spinning once\n"); + exec.spin_once(); - rclcpp::shutdown(); - return 0; + rclcpp::shutdown(); + return 0; } diff --git a/tracetools_test/src/test_service.cpp b/tracetools_test/src/test_service.cpp index c347b21..f44cfbb 100644 --- a/tracetools_test/src/test_service.cpp +++ b/tracetools_test/src/test_service.cpp @@ -6,43 +6,45 @@ class ServiceNode : public rclcpp::Node { public: - ServiceNode(rclcpp::NodeOptions options) : Node("service_node", options) - { - srv_ = this->create_service( - "service", - std::bind(&ServiceNode::service_callback, - this, - std::placeholders::_1, - std::placeholders::_2, - std::placeholders::_3)); - } + explicit ServiceNode(rclcpp::NodeOptions options) + : Node("service_node", options) + { + srv_ = this->create_service( + "service", + std::bind( + &ServiceNode::service_callback, + this, + std::placeholders::_1, + std::placeholders::_2, + std::placeholders::_3)); + } private: - void service_callback( - const std::shared_ptr request_header, - const std::shared_ptr request, - const std::shared_ptr response) - { - // Nothing - (void)request_header; - (void)request; - (void)response; - } + void service_callback( + const std::shared_ptr request_header, + const std::shared_ptr request, + const std::shared_ptr response) + { + // Nothing + (void)request_header; + (void)request; + (void)response; + } - rclcpp::Service::SharedPtr srv_; + rclcpp::Service::SharedPtr srv_; }; -int main(int argc, char* argv[]) +int main(int argc, char * argv[]) { - rclcpp::init(argc, argv); + rclcpp::init(argc, argv); - rclcpp::executors::SingleThreadedExecutor exec; - auto service_node = std::make_shared(rclcpp::NodeOptions()); - exec.add_node(service_node); + rclcpp::executors::SingleThreadedExecutor exec; + auto service_node = std::make_shared(rclcpp::NodeOptions()); + exec.add_node(service_node); - printf("spinning once\n"); - exec.spin_once(); + printf("spinning once\n"); + exec.spin_once(); - rclcpp::shutdown(); - return 0; + rclcpp::shutdown(); + return 0; } diff --git a/tracetools_test/src/test_service_ping.cpp b/tracetools_test/src/test_service_ping.cpp index cbc5fec..43a63dd 100644 --- a/tracetools_test/src/test_service_ping.cpp +++ b/tracetools_test/src/test_service_ping.cpp @@ -6,63 +6,63 @@ using namespace std::chrono_literals; - class PingNode : public rclcpp::Node { public: - PingNode(rclcpp::NodeOptions options) : Node("ping_node", options) - { - srv_ = this->create_service( - "pong", - std::bind(&PingNode::service_callback, - this, - std::placeholders::_1, - std::placeholders::_2, - std::placeholders::_3)); - client_ = this->create_client( - "ping"); - timer_ = this->create_wall_timer( - 500ms, - std::bind(&PingNode::timer_callback, this)); - } - + explicit PingNode(rclcpp::NodeOptions options) + : Node("ping_node", options) + { + srv_ = this->create_service( + "pong", + std::bind( + &PingNode::service_callback, + this, + std::placeholders::_1, + std::placeholders::_2, + std::placeholders::_3)); + client_ = this->create_client( + "ping"); + timer_ = this->create_wall_timer( + 500ms, + std::bind(&PingNode::timer_callback, this)); + } private: - void service_callback( - const std::shared_ptr request_header, - const std::shared_ptr request, - const std::shared_ptr response) - { - (void)request_header; - (void)request; - (void)response; - RCLCPP_INFO(this->get_logger(), "got request"); - rclcpp::shutdown(); - } + void service_callback( + const std::shared_ptr request_header, + const std::shared_ptr request, + const std::shared_ptr response) + { + (void)request_header; + (void)request; + (void)response; + RCLCPP_INFO(this->get_logger(), "got request"); + rclcpp::shutdown(); + } - void timer_callback() - { - auto req = std::make_shared(); - client_->async_send_request(req); - } + void timer_callback() + { + auto req = std::make_shared(); + client_->async_send_request(req); + } - rclcpp::Service::SharedPtr srv_; - rclcpp::Client::SharedPtr client_; - rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Service::SharedPtr srv_; + rclcpp::Client::SharedPtr client_; + rclcpp::TimerBase::SharedPtr timer_; }; -int main(int argc, char* argv[]) +int main(int argc, char * argv[]) { - rclcpp::init(argc, argv); + rclcpp::init(argc, argv); - rclcpp::executors::SingleThreadedExecutor exec; - auto ping_node = std::make_shared(rclcpp::NodeOptions()); - exec.add_node(ping_node); + rclcpp::executors::SingleThreadedExecutor exec; + auto ping_node = std::make_shared(rclcpp::NodeOptions()); + exec.add_node(ping_node); - printf("spinning\n"); - exec.spin(); + printf("spinning\n"); + exec.spin(); - // Will actually be called inside the node's service callback - rclcpp::shutdown(); - return 0; + // Will actually be called inside the node's service callback + rclcpp::shutdown(); + return 0; } diff --git a/tracetools_test/src/test_service_pong.cpp b/tracetools_test/src/test_service_pong.cpp index f09f761..29be746 100644 --- a/tracetools_test/src/test_service_pong.cpp +++ b/tracetools_test/src/test_service_pong.cpp @@ -3,55 +3,54 @@ #include "rclcpp/rclcpp.hpp" #include "std_srvs/srv/empty.hpp" - class PongNode : public rclcpp::Node { public: - PongNode(rclcpp::NodeOptions options) : Node("pong_node", options) - { - srv_ = this->create_service( - "ping", - std::bind(&PongNode::service_callback, - this, - std::placeholders::_1, - std::placeholders::_2, - std::placeholders::_3)); - client_ = this->create_client( - "pong"); - } - + explicit PongNode(rclcpp::NodeOptions options) + : Node("pong_node", options) + { + srv_ = this->create_service( + "ping", + std::bind( + &PongNode::service_callback, + this, + std::placeholders::_1, + std::placeholders::_2, + std::placeholders::_3)); + client_ = this->create_client("pong"); + } private: - void service_callback( - const std::shared_ptr request_header, - const std::shared_ptr request, - const std::shared_ptr response) - { - (void)request_header; - (void)request; - (void)response; - RCLCPP_INFO(this->get_logger(), "got request"); - auto req = std::make_shared(); - client_->async_send_request(req); - rclcpp::shutdown(); - } + void service_callback( + const std::shared_ptr request_header, + const std::shared_ptr request, + const std::shared_ptr response) + { + (void)request_header; + (void)request; + (void)response; + RCLCPP_INFO(this->get_logger(), "got request"); + auto req = std::make_shared(); + client_->async_send_request(req); + rclcpp::shutdown(); + } - rclcpp::Service::SharedPtr srv_; - rclcpp::Client::SharedPtr client_; + rclcpp::Service::SharedPtr srv_; + rclcpp::Client::SharedPtr client_; }; -int main(int argc, char* argv[]) +int main(int argc, char * argv[]) { - rclcpp::init(argc, argv); + rclcpp::init(argc, argv); - rclcpp::executors::SingleThreadedExecutor exec; - auto pong_node = std::make_shared(rclcpp::NodeOptions()); - exec.add_node(pong_node); + rclcpp::executors::SingleThreadedExecutor exec; + auto pong_node = std::make_shared(rclcpp::NodeOptions()); + exec.add_node(pong_node); - printf("spinning\n"); - exec.spin(); + printf("spinning\n"); + exec.spin(); - // Will actually be called inside the node's service callback - rclcpp::shutdown(); - return 0; + // Will actually be called inside the node's service callback + rclcpp::shutdown(); + return 0; } diff --git a/tracetools_test/src/test_subscription.cpp b/tracetools_test/src/test_subscription.cpp index 9207de4..f8d1002 100644 --- a/tracetools_test/src/test_subscription.cpp +++ b/tracetools_test/src/test_subscription.cpp @@ -3,39 +3,39 @@ #include "rclcpp/rclcpp.hpp" #include "std_msgs/msg/string.hpp" - class SubNode : public rclcpp::Node { public: - SubNode(rclcpp::NodeOptions options) : Node("sub_node", options) - { - sub_ = this->create_subscription( - "the_topic", - rclcpp::QoS(10), - std::bind(&SubNode::callback, this, std::placeholders::_1)); - } + explicit SubNode(rclcpp::NodeOptions options) + : Node("sub_node", options) + { + sub_ = this->create_subscription( + "the_topic", + rclcpp::QoS(10), + std::bind(&SubNode::callback, this, std::placeholders::_1)); + } private: - void callback(const std_msgs::msg::String::SharedPtr msg) - { - // Nothing - (void)msg; - } + void callback(const std_msgs::msg::String::SharedPtr msg) + { + // Nothing + (void)msg; + } - rclcpp::Subscription::SharedPtr sub_; + rclcpp::Subscription::SharedPtr sub_; }; -int main(int argc, char* argv[]) +int main(int argc, char * argv[]) { - rclcpp::init(argc, argv); + rclcpp::init(argc, argv); - rclcpp::executors::SingleThreadedExecutor exec; - auto sub_node = std::make_shared(rclcpp::NodeOptions()); - exec.add_node(sub_node); + rclcpp::executors::SingleThreadedExecutor exec; + auto sub_node = std::make_shared(rclcpp::NodeOptions()); + exec.add_node(sub_node); - printf("spinning once\n"); - exec.spin_once(); + printf("spinning once\n"); + exec.spin_once(); - rclcpp::shutdown(); - return 0; + rclcpp::shutdown(); + return 0; } diff --git a/tracetools_test/src/test_timer.cpp b/tracetools_test/src/test_timer.cpp index 2c787f0..2727184 100644 --- a/tracetools_test/src/test_timer.cpp +++ b/tracetools_test/src/test_timer.cpp @@ -1,47 +1,48 @@ +#include #include #include "rclcpp/rclcpp.hpp" using namespace std::chrono_literals; - class TimerNode : public rclcpp::Node { public: - TimerNode(rclcpp::NodeOptions options) : Node("timer_node", options) - { - is_done_ = false; - timer_ = this->create_wall_timer( - 1ms, - std::bind(&TimerNode::timer_callback, this)); - } + explicit TimerNode(rclcpp::NodeOptions options) + : Node("timer_node", options) + { + is_done_ = false; + timer_ = this->create_wall_timer( + 1ms, + std::bind(&TimerNode::timer_callback, this)); + } private: - void timer_callback() - { - if (is_done_) { - rclcpp::shutdown(); - } else { - is_done_ = true; - } + void timer_callback() + { + if (is_done_) { + rclcpp::shutdown(); + } else { + is_done_ = true; } + } - rclcpp::TimerBase::SharedPtr timer_; - bool is_done_; + rclcpp::TimerBase::SharedPtr timer_; + bool is_done_; }; -int main(int argc, char* argv[]) +int main(int argc, char * argv[]) { - rclcpp::init(argc, argv); + rclcpp::init(argc, argv); - rclcpp::executors::SingleThreadedExecutor exec; - auto timer_node = std::make_shared(rclcpp::NodeOptions()); - exec.add_node(timer_node); + rclcpp::executors::SingleThreadedExecutor exec; + auto timer_node = std::make_shared(rclcpp::NodeOptions()); + exec.add_node(timer_node); - printf("spinning\n"); - exec.spin(); + printf("spinning\n"); + exec.spin(); - // Will actually be called inside the timer's callback - rclcpp::shutdown(); - return 0; + // Will actually be called inside the timer's callback + rclcpp::shutdown(); + return 0; } diff --git a/tracetools_test/test/test_node.py b/tracetools_test/test/test_node.py index 08973e2..18aae36 100644 --- a/tracetools_test/test/test_node.py +++ b/tracetools_test/test/test_node.py @@ -1,8 +1,9 @@ import unittest + from tracetools_test.utils import ( + cleanup_trace, get_trace_event_names, run_and_trace, - cleanup_trace, ) BASE_PATH = '/tmp' @@ -12,6 +13,7 @@ node_creation_events = [ 'ros2:rcl_node_init', ] + class TestNode(unittest.TestCase): def test_creation(self): diff --git a/tracetools_test/test/test_publisher.py b/tracetools_test/test/test_publisher.py index 2c058b9..1eb4544 100644 --- a/tracetools_test/test/test_publisher.py +++ b/tracetools_test/test/test_publisher.py @@ -1,8 +1,9 @@ import unittest + from tracetools_test.utils import ( + cleanup_trace, get_trace_event_names, run_and_trace, - cleanup_trace, ) BASE_PATH = '/tmp' @@ -11,6 +12,7 @@ publisher_creation_events = [ 'ros2:rcl_publisher_init', ] + class TestPublisher(unittest.TestCase): def test_creation(self): diff --git a/tracetools_test/test/test_service.py b/tracetools_test/test/test_service.py index 4230c4d..0e10508 100644 --- a/tracetools_test/test/test_service.py +++ b/tracetools_test/test/test_service.py @@ -1,8 +1,9 @@ import unittest + from tracetools_test.utils import ( + cleanup_trace, get_trace_event_names, run_and_trace, - cleanup_trace, ) BASE_PATH = '/tmp' @@ -12,6 +13,7 @@ service_creation_events = [ 'ros2:rclcpp_service_callback_added', ] + class TestService(unittest.TestCase): def test_creation(self): diff --git a/tracetools_test/test/test_service_callback.py b/tracetools_test/test/test_service_callback.py index 8992f9a..fccdccd 100644 --- a/tracetools_test/test/test_service_callback.py +++ b/tracetools_test/test/test_service_callback.py @@ -1,8 +1,9 @@ import unittest + from tracetools_test.utils import ( + cleanup_trace, get_trace_event_names, run_and_trace, - cleanup_trace, ) BASE_PATH = '/tmp' @@ -12,6 +13,7 @@ service_callback_events = [ 'ros2:rclcpp_service_callback_end', ] + class TestServiceCallback(unittest.TestCase): def test_callback(self): diff --git a/tracetools_test/test/test_subscription.py b/tracetools_test/test/test_subscription.py index d689c8f..54e3166 100644 --- a/tracetools_test/test/test_subscription.py +++ b/tracetools_test/test/test_subscription.py @@ -1,8 +1,9 @@ import unittest + from tracetools_test.utils import ( + cleanup_trace, get_trace_event_names, run_and_trace, - cleanup_trace, ) BASE_PATH = '/tmp' @@ -12,6 +13,7 @@ subscription_creation_events = [ 'ros2:rclcpp_subscription_callback_added', ] + class TestSubscription(unittest.TestCase): def test_creation(self): diff --git a/tracetools_test/test/test_subscription_callback.py b/tracetools_test/test/test_subscription_callback.py index c0112f0..d51b2ae 100644 --- a/tracetools_test/test/test_subscription_callback.py +++ b/tracetools_test/test/test_subscription_callback.py @@ -1,8 +1,9 @@ import unittest + from tracetools_test.utils import ( + cleanup_trace, get_trace_event_names, run_and_trace, - cleanup_trace, ) BASE_PATH = '/tmp' @@ -12,6 +13,7 @@ subscription_callback_events = [ 'ros2:rclcpp_subscription_callback_end', ] + class TestSubscriptionCallback(unittest.TestCase): def test_callback(self): diff --git a/tracetools_test/test/test_timer.py b/tracetools_test/test/test_timer.py index 6716ee7..fc12b42 100644 --- a/tracetools_test/test/test_timer.py +++ b/tracetools_test/test/test_timer.py @@ -1,8 +1,9 @@ import unittest + from tracetools_test.utils import ( + cleanup_trace, get_trace_event_names, run_and_trace, - cleanup_trace, ) BASE_PATH = '/tmp' @@ -14,6 +15,7 @@ timer_events = [ 'ros2:rclcpp_timer_callback_end', ] + class TestTimer(unittest.TestCase): def test_all(self): diff --git a/tracetools_test/tracetools_test/utils.py b/tracetools_test/tracetools_test/utils.py index 462cb23..af9e0ae 100644 --- a/tracetools_test/tracetools_test/utils.py +++ b/tracetools_test/tracetools_test/utils.py @@ -1,23 +1,30 @@ # Utils for tracetools_test -import time import shutil -import subprocess +import time + import babeltrace from launch import LaunchDescription from launch import LaunchService from launch_ros import get_default_launch_description import launch_ros.actions from tracetools_trace.tools.lttng import ( + lttng_destroy, lttng_setup, lttng_start, lttng_stop, - lttng_destroy, ) -def run_and_trace(base_path, session_name_prefix, ros_events, kernel_events, package_name, node_names): + +def run_and_trace(base_path, + session_name_prefix, + ros_events, + kernel_events, + package_name, + node_names): """ - Run a node while tracing + Run a node while tracing. + :param base_path (str): the base path where to put the trace directory :param session_name_prefix (str): the session name prefix for the trace directory :param ros_events (list(str)): the list of ROS UST events to enable @@ -53,7 +60,8 @@ def run_and_trace(base_path, session_name_prefix, ros_events, kernel_events, pac def cleanup_trace(full_path): """ - Cleanup trace data + Cleanup trace data. + :param full_path (str): the full path to the main trace directory """ shutil.rmtree(full_path) @@ -61,7 +69,8 @@ def cleanup_trace(full_path): def get_trace_event_names(trace_directory): """ - Get a set of event names in a trace + Get a set of event names in a trace. + :param trace_directory (str): the path to the main/top trace directory :return: event names (set(str)) """