diff --git a/CARET_trace/CMakeLists.txt b/CARET_trace/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/CARET_trace/include/caret_trace/clock.hpp b/CARET_trace/include/caret_trace/clock.hpp old mode 100644 new mode 100755 diff --git a/CARET_trace/include/caret_trace/container_traits.hpp b/CARET_trace/include/caret_trace/container_traits.hpp old mode 100644 new mode 100755 index ae522a1c..6ccda646 --- a/CARET_trace/include/caret_trace/container_traits.hpp +++ b/CARET_trace/include/caret_trace/container_traits.hpp @@ -18,7 +18,7 @@ /// @brief Type traits for container. /// @tparam ...Args Container types. -template +template class ContainerTraits { public: diff --git a/CARET_trace/include/caret_trace/context.hpp b/CARET_trace/include/caret_trace/context.hpp old mode 100644 new mode 100755 diff --git a/CARET_trace/include/caret_trace/data_container.hpp b/CARET_trace/include/caret_trace/data_container.hpp old mode 100644 new mode 100755 index b111e93c..da31c31a --- a/CARET_trace/include/caret_trace/data_container.hpp +++ b/CARET_trace/include/caret_trace/data_container.hpp @@ -184,10 +184,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_add_callback_group(Args... args) { - return add_callback_group_->store(args...); + return add_callback_group_->store(args ...); } /// @brief Store data for add_callback_group_static_executor trace points. @@ -195,10 +195,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_add_callback_group_static_executor(Args... args) { - return add_callback_group_static_executor_->store(args...); + return add_callback_group_static_executor_->store(args ...); } /// @brief Store data for callback_group_add_client trace points. @@ -206,10 +206,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_callback_group_add_client(Args... args) { - return callback_group_add_client_->store(args...); + return callback_group_add_client_->store(args ...); } /// @brief Store data for callback_group_add_service trace points. @@ -217,10 +217,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_callback_group_add_service(Args... args) { - return callback_group_add_service_->store(args...); + return callback_group_add_service_->store(args ...); } /// @brief Store data for callback_group_add_subscription trace points. @@ -228,10 +228,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_callback_group_add_subscription(Args... args) { - return callback_group_add_subscription_->store(args...); + return callback_group_add_subscription_->store(args ...); } /// @brief Store data for callback_group_add_timer trace points. @@ -239,10 +239,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_callback_group_add_timer(Args... args) { - return callback_group_add_timer_->store(args...); + return callback_group_add_timer_->store(args ...); } /// @brief Store data for construct_executor trace points. @@ -250,10 +250,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_construct_executor(Args... args) { - return construct_executor_->store(args...); + return construct_executor_->store(args ...); } /// @brief Store data for construct_static_executor trace points. @@ -261,10 +261,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_construct_static_executor(Args... args) { - return construct_static_executor_->store(args...); + return construct_static_executor_->store(args ...); } /// @brief Store data for rcl_node_init trace points. @@ -272,10 +272,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rcl_node_init(Args... args) { - return rcl_node_init_->store(args...); + return rcl_node_init_->store(args ...); } /// @brief Store data for rcl_init trace points. @@ -283,10 +283,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rcl_init(Args... args) { - return rcl_init_->store(args...); + return rcl_init_->store(args ...); } /// @brief Store data for rcl_subscription_init trace points. @@ -294,10 +294,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rcl_subscription_init(Args... args) { - return rcl_subscription_init_->store(args...); + return rcl_subscription_init_->store(args ...); } /// @brief Store data for rclcpp_callback_register trace points. @@ -305,10 +305,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rclcpp_callback_register(Args... args) { - return rclcpp_callback_register_->store(args...); + return rclcpp_callback_register_->store(args ...); } /// @brief Store data for rclcpp_subscription_init trace points. @@ -316,10 +316,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rclcpp_subscription_init(Args... args) { - return rclcpp_subscription_init_->store(args...); + return rclcpp_subscription_init_->store(args ...); } /// @brief Store data for rclcpp_subscription_callback_added trace points. @@ -327,10 +327,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rclcpp_subscription_callback_added(Args... args) { - return rclcpp_subscription_callback_added_->store(args...); + return rclcpp_subscription_callback_added_->store(args ...); } /// @brief Store data for rclcpp_timer_callback_added trace points. @@ -338,10 +338,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rclcpp_timer_callback_added(Args... args) { - return rclcpp_timer_callback_added_->store(args...); + return rclcpp_timer_callback_added_->store(args ...); } /// @brief Store data for rclcpp_timer_link_node trace points. @@ -349,10 +349,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rclcpp_timer_link_node(Args... args) { - return rclcpp_timer_link_node_->store(args...); + return rclcpp_timer_link_node_->store(args ...); } /// @brief Store data for rcl_timer_init trace points. @@ -360,10 +360,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rcl_timer_init(Args... args) { - return rcl_timer_init_->store(args...); + return rcl_timer_init_->store(args ...); } /// @brief Store data for rcl_publisher_init trace points. @@ -371,10 +371,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rcl_publisher_init(Args... args) { - return rcl_publisher_init_->store(args...); + return rcl_publisher_init_->store(args ...); } /// @brief Store data for rcl_client_init trace points. @@ -382,10 +382,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rcl_client_init(Args... args) { - return rcl_client_init_->store(args...); + return rcl_client_init_->store(args ...); } /// @brief Store data for rclcpp_service_callback_added trace points. @@ -393,10 +393,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rclcpp_service_callback_added(Args... args) { - return rclcpp_service_callback_added_->store(args...); + return rclcpp_service_callback_added_->store(args ...); } /// @brief Store data for rcl_service_init trace points. @@ -404,10 +404,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rcl_service_init(Args... args) { - return rcl_service_init_->store(args...); + return rcl_service_init_->store(args ...); } /// @brief Store data for rmw_implementation trace points. @@ -415,10 +415,10 @@ class DataContainer : public DataContainerInterface /// @param ...args Data to be stored. /// @return True, data was stored to pending set. /// @return False, data was stored to set. - template + template bool store_rmw_implementation(Args... args) { - return rmw_implementation_->store(args...); + return rmw_implementation_->store(args ...); } /// @brief Assign recording function for add_callback_group trace points. diff --git a/CARET_trace/include/caret_trace/data_recorder.hpp b/CARET_trace/include/caret_trace/data_recorder.hpp old mode 100644 new mode 100755 index 83bfb26f..51964834 --- a/CARET_trace/include/caret_trace/data_recorder.hpp +++ b/CARET_trace/include/caret_trace/data_recorder.hpp @@ -1,4 +1,3 @@ - // Copyright 2021 Research Institute of Systems Planning, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/CARET_trace/include/caret_trace/keys_set.hpp b/CARET_trace/include/caret_trace/keys_set.hpp old mode 100644 new mode 100755 index fd8d6ab8..00525f32 --- a/CARET_trace/include/caret_trace/keys_set.hpp +++ b/CARET_trace/include/caret_trace/keys_set.hpp @@ -22,14 +22,14 @@ #include /// @private -template +template struct if_ { using type = Then; }; /// @private -template +template struct if_ { using type = Else; @@ -74,18 +74,21 @@ class HashableKeys public: /// @brief Construct an instance. /// @param key1 first argument. - explicit HashableKeys(T1 key1) : key1_(key1) {} + explicit HashableKeys(T1 key1) + : key1_(key1) {} /// @brief Construct an instance. /// @param key1 first argument. /// @param key2 second argument. - HashableKeys(T1 key1, T2 key2) : key1_(key1), key2_(key2) {} + HashableKeys(T1 key1, T2 key2) + : key1_(key1), key2_(key2) {} /// @brief Construct an instance. /// @param key1 first argument. /// @param key2 second argument. /// @param key3 third argument. - HashableKeys(T1 key1, T2 key2, T3 key3) : key1_(key1), key2_(key2), key3_(key3) {} + HashableKeys(T1 key1, T2 key2, T3 key3) + : key1_(key1), key2_(key2), key3_(key3) {} /// @brief Construct an instance. /// @param key1 first argument. @@ -301,13 +304,13 @@ class HashableKeys namespace std { -template +template struct hash> { - size_t operator()(const HashableKeys & t) const { return t.hash(); } + size_t operator()(const HashableKeys & t) const {return t.hash();} }; -template +template struct equal_to> { size_t operator()( @@ -327,7 +330,7 @@ struct equal_to> /// @tparam T5 Third argument type. /// @tparam T6 Third argument type. // clang-format off -template < +template< typename T1, typename T2 = std::false_type, typename T3 = std::false_type, @@ -414,10 +417,10 @@ class KeysSet /// @param key4 Fourth argument. /// @param key5 Fifth argument. /// @return True if it contains, false otherwise. - void insert(HashableKeys keys) { keys_.insert(keys); } + void insert(HashableKeys keys) {keys_.insert(keys);} /// @brief Clear set. - void clear() { keys_.clear(); } + void clear() {keys_.clear();} /// @brief Confirm content. /// @param key1 First argument. @@ -491,15 +494,15 @@ class KeysSet /// @brief Get const iterator /// @return Iterator referring to the first element. - ConstIteratorT begin() const { return keys_.cbegin(); } + ConstIteratorT begin() const {return keys_.cbegin();} /// @brief Get const iterator /// @return Iterator referring to the last element. - ConstIteratorT end() const { return keys_.cend(); } + ConstIteratorT end() const {return keys_.cend();} /// @brief Get size. /// @return Element number. - size_t size() const { return keys_.size(); } + size_t size() const {return keys_.size();} private: SetT keys_; diff --git a/CARET_trace/include/caret_trace/lttng_session.hpp b/CARET_trace/include/caret_trace/lttng_session.hpp old mode 100644 new mode 100755 index 4372f76e..466611ef --- a/CARET_trace/include/caret_trace/lttng_session.hpp +++ b/CARET_trace/include/caret_trace/lttng_session.hpp @@ -44,7 +44,8 @@ class LttngSession class LttngSessionImpl : public LttngSession { public: - LttngSessionImpl() : started_session_running_(is_session_running()) {} + LttngSessionImpl() + : started_session_running_(is_session_running()) {} ~LttngSessionImpl() {} diff --git a/CARET_trace/include/caret_trace/recordable_data.hpp b/CARET_trace/include/caret_trace/recordable_data.hpp old mode 100644 new mode 100755 index d61f011a..a511389e --- a/CARET_trace/include/caret_trace/recordable_data.hpp +++ b/CARET_trace/include/caret_trace/recordable_data.hpp @@ -67,23 +67,24 @@ class RecordableDataInterface class DummyRecordableKeysSet : public RecordableDataInterface { public: - DummyRecordableKeysSet() : trace_point_("dummy_recordable_keys_set") {} + DummyRecordableKeysSet() + : trace_point_("dummy_recordable_keys_set") {} - bool finished() const override { return true; } + bool finished() const override {return true;} void start() override {} - bool is_recording() const override { return true; } + bool is_recording() const override {return true;} void record_next_one() override {} void reset() override {} - const std::string & trace_point() const override { return trace_point_; } + const std::string & trace_point() const override {return trace_point_;} - size_t size() const override { return 0; } + size_t size() const override {return 0;} - size_t pending_size() const override { return 0; } + size_t pending_size() const override {return 0;} private: const std::string trace_point_; @@ -91,15 +92,15 @@ class DummyRecordableKeysSet : public RecordableDataInterface /// @brief Data container class with sequential recording API. /// @tparam ...Args Trace point data types. -template +template class RecordableData : public RecordableDataInterface { private: using KeyT = HashableKeys; public: - using FuncT = void(Args...); - using StdFuncT = std::function; + using FuncT = void (Args ...); + using StdFuncT = std::function; /// @brief Construct an instance. /// @param trace_point Trace point name for this instance. @@ -110,7 +111,8 @@ class RecordableData : public RecordableDataInterface /// @brief Construct an instance. /// @param trace_point Trace point name for this instance. - explicit RecordableData(char * trace_point) : RecordableData(std::string(trace_point)) {} + explicit RecordableData(char * trace_point) + : RecordableData(std::string(trace_point)) {} ~RecordableData() override {} @@ -144,11 +146,11 @@ class RecordableData : public RecordableDataInterface if (is_iterating_) { // PREPARE state - pending_set_.insert(args...); + pending_set_.insert(args ...); return true; } else { // OTHER state - set_.insert(args...); + set_.insert(args ...); return false; } } diff --git a/CARET_trace/include/caret_trace/singleton.hpp b/CARET_trace/include/caret_trace/singleton.hpp old mode 100644 new mode 100755 index 00f74e18..76dcfd5a --- a/CARET_trace/include/caret_trace/singleton.hpp +++ b/CARET_trace/include/caret_trace/singleton.hpp @@ -27,7 +27,7 @@ class SingletonFinalizer /// @brief Class for use as a singleton. /// @tparam T Target class type. -template +template class Singleton final { public: @@ -57,10 +57,10 @@ class Singleton final static T * instance; }; -template +template std::once_flag Singleton::initFlag; -template +template T * Singleton::instance = nullptr; #endif // CARET_TRACE__SINGLETON_HPP_ diff --git a/CARET_trace/include/caret_trace/tp.h b/CARET_trace/include/caret_trace/tp.h old mode 100644 new mode 100755 diff --git a/CARET_trace/include/caret_trace/trace_node.hpp b/CARET_trace/include/caret_trace/trace_node.hpp old mode 100644 new mode 100755 index ccc91c9b..ff2c8e69 --- a/CARET_trace/include/caret_trace/trace_node.hpp +++ b/CARET_trace/include/caret_trace/trace_node.hpp @@ -26,7 +26,8 @@ #include #include -enum class TRACE_STATUS { +enum class TRACE_STATUS +{ UNINITIALIZED, WAIT, PREPARE, diff --git a/CARET_trace/include/caret_trace/tracing_controller.hpp b/CARET_trace/include/caret_trace/tracing_controller.hpp old mode 100644 new mode 100755 diff --git a/CARET_trace/package.xml b/CARET_trace/package.xml old mode 100644 new mode 100755 diff --git a/CARET_trace/src/clock.cpp b/CARET_trace/src/clock.cpp old mode 100644 new mode 100755 diff --git a/CARET_trace/src/clock_recorder.cpp b/CARET_trace/src/clock_recorder.cpp old mode 100644 new mode 100755 index 2131210c..9a7d1960 --- a/CARET_trace/src/clock_recorder.cpp +++ b/CARET_trace/src/clock_recorder.cpp @@ -28,25 +28,26 @@ using namespace std::literals::chrono_literals; class ClockRecorder : public rclcpp::Node { public: - ClockRecorder() : Node("clock_recorder") + ClockRecorder() + : Node("clock_recorder") { auto use_sim_time = rclcpp::Parameter("use_sim_time", true); set_parameter(use_sim_time); RCLCPP_INFO(get_logger(), "clock_recorder started to record sim time."); auto timer_callback = [&]() { - auto now = this->now(); - // std::cout << static_cast(now.seconds()) << std::endl; - // The /clock topic will not be recorded while it is not published. - if (now.nanoseconds() == 0) { - RCLCPP_WARN_THROTTLE( - get_logger(), *timer_steady_, 3000, // per 3 second. - "Failed to get simtime correctly. /clock topic may not have been published."); - return; - } - RCLCPP_DEBUG(get_logger(), "sim_time recorded: %ld.", now.nanoseconds()); - tracepoint(TRACEPOINT_PROVIDER, sim_time, now.nanoseconds()); - }; + auto now = this->now(); + // std::cout << static_cast(now.seconds()) << std::endl; + // The /clock topic will not be recorded while it is not published. + if (now.nanoseconds() == 0) { + RCLCPP_WARN_THROTTLE( + get_logger(), *timer_steady_, 3000, // per 3 second. + "Failed to get simtime correctly. /clock topic may not have been published."); + return; + } + RCLCPP_DEBUG(get_logger(), "sim_time recorded: %ld.", now.nanoseconds()); + tracepoint(TRACEPOINT_PROVIDER, sim_time, now.nanoseconds()); + }; timer_ = create_wall_timer(1s, timer_callback); timer_steady_ = std::make_shared(RCL_STEADY_TIME); } diff --git a/CARET_trace/src/context.cpp b/CARET_trace/src/context.cpp old mode 100644 new mode 100755 diff --git a/CARET_trace/src/data_container.cpp b/CARET_trace/src/data_container.cpp old mode 100644 new mode 100755 diff --git a/CARET_trace/src/data_recorder.cpp b/CARET_trace/src/data_recorder.cpp old mode 100644 new mode 100755 diff --git a/CARET_trace/src/hooked_trace_points.cpp b/CARET_trace/src/hooked_trace_points.cpp old mode 100644 new mode 100755 index 955f857d..f2f63cfa --- a/CARET_trace/src/hooked_trace_points.cpp +++ b/CARET_trace/src/hooked_trace_points.cpp @@ -45,8 +45,8 @@ #include "caret_trace/keys_set.hpp" -#define SYMBOL_CONCAT_2(x, y) x##y -#define SYMBOL_CONCAT_3(x, y, z) x##y##z +#define SYMBOL_CONCAT_2(x, y) x ## y +#define SYMBOL_CONCAT_3(x, y, z) x ## y ## z extern thread_local bool trace_filter_is_rcl_publish_recorded; @@ -116,7 +116,7 @@ class StaticSingleThreadedExecutorPublic : public rclcpp::Executor RCLCPP_PUBLIC std::vector get_automatically_added_callback_groups_from_nodes() - override; + override; // protected: RCLCPP_PUBLIC @@ -186,8 +186,8 @@ void update_dds_function_addr() } static auto record = [](const char * rmw_implementation, int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, rmw_implementation, rmw_implementation, init_time); - }; + tracepoint(TRACEPOINT_PROVIDER, rmw_implementation, rmw_implementation, init_time); + }; if (!data_container.is_assigned_rmw_implementation()) { data_container.assign_rmw_implementation(record); @@ -263,12 +263,12 @@ void _ZN6rclcpp9executors22SingleThreadedExecutorC1ERKNS_15ExecutorOptionsE( static auto & clock = context.get_clock(); static auto & data_container = context.get_data_container(); static auto record = [](const void * obj, const char * executor_type_name, int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, construct_executor, obj, executor_type_name, init_time); + tracepoint(TRACEPOINT_PROVIDER, construct_executor, obj, executor_type_name, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "construct_executor," << executor_type_name << "," << obj << std::endl; + std::cerr << "construct_executor," << executor_type_name << "," << obj << std::endl; #endif - }; + }; auto now = clock.now(); using functionT = void (*)(void *, const void *); ((functionT)orig_func)(obj, option); @@ -294,11 +294,11 @@ void SYMBOL_CONCAT_2( { static void * orig_func = dlsym(RTLD_NEXT, __func__); static auto record = [](const void * obj, const char * executor_type_name, int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, construct_executor, obj, executor_type_name, init_time); + tracepoint(TRACEPOINT_PROVIDER, construct_executor, obj, executor_type_name, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "construct_executor," << executor_type_name << "," << obj << std::endl; + std::cerr << "construct_executor," << executor_type_name << "," << obj << std::endl; #endif - }; + }; static auto & context = Singleton::get_instance(); static auto & clock = context.get_clock(); auto now = clock.now(); @@ -327,18 +327,18 @@ void _ZN6rclcpp9executors28StaticSingleThreadedExecutorC1ERKNS_15ExecutorOptions static auto & clock = context.get_clock(); static auto & data_container = context.get_data_container(); static auto record = []( - const void * obj, const void * entities_collector_ptr, - const char * executor_type, int64_t init_time) { - tracepoint( - TRACEPOINT_PROVIDER, construct_static_executor, obj, entities_collector_ptr, executor_type, - init_time); + const void * obj, const void * entities_collector_ptr, + const char * executor_type, int64_t init_time) { + tracepoint( + TRACEPOINT_PROVIDER, construct_static_executor, obj, entities_collector_ptr, executor_type, + init_time); #ifdef DEBUG_OUTPUT - std::cerr << "construct_static_executor," - << "static_single_threaded_executor" - << "," << obj << "," << entities_collector_ptr << std::endl; + std::cerr << "construct_static_executor," + << "static_single_threaded_executor" + << "," << obj << "," << entities_collector_ptr << std::endl; #endif - }; + }; auto now = clock.now(); using functionT = void (*)(void *, const void *); @@ -481,12 +481,12 @@ void _ZN6rclcpp13CallbackGroup9add_timerESt10shared_ptrINS_9TimerBaseEE( static auto & clock = context.get_clock(); static auto & data_container = context.get_data_container(); static auto record = [](const void * obj, const void * timer_handle, int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, callback_group_add_timer, obj, timer_handle, init_time); + tracepoint(TRACEPOINT_PROVIDER, callback_group_add_timer, obj, timer_handle, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "callback_group_add_timer," << obj << "," << timer_handle << std::endl; + std::cerr << "callback_group_add_timer," << obj << "," << timer_handle << std::endl; #endif - }; + }; auto now = clock.now(); auto timer_handle = static_cast(timer_ptr->get_timer_handle().get()); @@ -510,14 +510,14 @@ void _ZN6rclcpp13CallbackGroup16add_subscriptionESt10shared_ptrINS_16Subscriptio static auto & clock = context.get_clock(); static auto & data_container = context.get_data_container(); static auto record = [](const void * obj, const void * subscription_handle, int64_t init_time) { - tracepoint( - TRACEPOINT_PROVIDER, callback_group_add_subscription, obj, subscription_handle, init_time); + tracepoint( + TRACEPOINT_PROVIDER, callback_group_add_subscription, obj, subscription_handle, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "callback_group_add_subscription," << obj << "," << subscription_handle - << std::endl; + std::cerr << "callback_group_add_subscription," << obj << "," << subscription_handle + << std::endl; #endif - }; + }; auto now = clock.now(); auto subscription_handle = @@ -542,12 +542,12 @@ void _ZN6rclcpp13CallbackGroup11add_serviceESt10shared_ptrINS_11ServiceBaseEE( static auto & clock = context.get_clock(); static auto & data_container = context.get_data_container(); static auto record = [](const void * obj, const void * service_handle, int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, callback_group_add_service, obj, service_handle, init_time); + tracepoint(TRACEPOINT_PROVIDER, callback_group_add_service, obj, service_handle, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "callback_group_add_service," << obj << "," << service_handle << std::endl; + std::cerr << "callback_group_add_service," << obj << "," << service_handle << std::endl; #endif - }; + }; auto now = clock.now(); auto service_handle = static_cast(service_ptr->get_service_handle().get()); @@ -571,12 +571,12 @@ void _ZN6rclcpp13CallbackGroup10add_clientESt10shared_ptrINS_10ClientBaseEE( static auto & clock = context.get_clock(); static auto & data_container = context.get_data_container(); static auto record = [](const void * obj, const void * client_handle, int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, callback_group_add_client, obj, client_handle, init_time); + tracepoint(TRACEPOINT_PROVIDER, callback_group_add_client, obj, client_handle, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "callback_group_add_client," << obj << "," << client_handle << std::endl; + std::cerr << "callback_group_add_client," << obj << "," << client_handle << std::endl; #endif - }; + }; auto now = clock.now(); auto client_handle = static_cast(client_ptr->get_client_handle().get()); diff --git a/CARET_trace/src/lttng_session.cpp b/CARET_trace/src/lttng_session.cpp old mode 100644 new mode 100755 diff --git a/CARET_trace/src/ros_trace_points.cpp b/CARET_trace/src/ros_trace_points.cpp old mode 100644 new mode 100755 index 984abe6d..88205d98 --- a/CARET_trace/src/ros_trace_points.cpp +++ b/CARET_trace/src/ros_trace_points.cpp @@ -166,23 +166,24 @@ void ros_trace_rcl_node_init( const char * node_name, const char * node_namespace, int64_t init_time - ) { - static auto & context = Singleton::get_instance(); - static auto & controller = context.get_controller(); - - if (!controller.is_allowed_node(node_handle)) { - return; - } - tracepoint(TRACEPOINT_PROVIDER, rcl_node_init, node_handle, rmw_handle, - node_name, node_namespace, init_time); + ) { + static auto & context = Singleton::get_instance(); + static auto & controller = context.get_controller(); + + if (!controller.is_allowed_node(node_handle)) { + return; + } + tracepoint( + TRACEPOINT_PROVIDER, rcl_node_init, node_handle, rmw_handle, + node_name, node_namespace, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "rcl_node_init," << - node_handle << "," << - rmw_handle << "," << - node_name << "," << - node_namespace << std::endl; + std::cerr << "rcl_node_init," << + node_handle << "," << + rmw_handle << "," << + node_name << "," << + node_namespace << std::endl; #endif - }; + }; auto now = clock.now(); @@ -225,24 +226,25 @@ void ros_trace_rcl_subscription_init( const char * topic_name, const size_t queue_depth, int64_t init_time - ) { - static auto & context = Singleton::get_instance(); - static auto & controller = context.get_controller(); - - if (!controller.is_allowed_subscription_handle(subscription_handle)) { - return; - } - tracepoint(TRACEPOINT_PROVIDER, rcl_subscription_init, subscription_handle, - node_handle, rmw_subscription_handle, topic_name, queue_depth, init_time); + ) { + static auto & context = Singleton::get_instance(); + static auto & controller = context.get_controller(); + + if (!controller.is_allowed_subscription_handle(subscription_handle)) { + return; + } + tracepoint( + TRACEPOINT_PROVIDER, rcl_subscription_init, subscription_handle, + node_handle, rmw_subscription_handle, topic_name, queue_depth, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "rcl_subscription_init," << - subscription_handle << "," << - node_handle << "," << - rmw_subscription_handle << "," << - topic_name << "," << - queue_depth << std::endl; + std::cerr << "rcl_subscription_init," << + subscription_handle << "," << + node_handle << "," << + rmw_subscription_handle << "," << + topic_name << "," << + queue_depth << std::endl; #endif - }; + }; auto now = clock.now(); @@ -274,20 +276,21 @@ void ros_trace_rclcpp_subscription_init( const void * subscription_handle, const void * subscription, int64_t init_time - ) { - static auto & context = Singleton::get_instance(); - static auto & controller = context.get_controller(); - if (!controller.is_allowed_subscription_handle(subscription_handle)){ - return; - } - tracepoint(TRACEPOINT_PROVIDER, rclcpp_subscription_init, - subscription_handle, subscription, init_time); + ) { + static auto & context = Singleton::get_instance(); + static auto & controller = context.get_controller(); + if (!controller.is_allowed_subscription_handle(subscription_handle)) { + return; + } + tracepoint( + TRACEPOINT_PROVIDER, rclcpp_subscription_init, + subscription_handle, subscription, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "rclcpp_subscription_init," << - subscription_handle << "," << - subscription << std::endl; + std::cerr << "rclcpp_subscription_init," << + subscription_handle << "," << + subscription << std::endl; #endif - }; + }; auto now = clock.now(); check_and_run_trace_node(); @@ -316,18 +319,19 @@ void ros_trace_rclcpp_subscription_callback_added( const void * subscription, const void * callback, int64_t init_time - ) { - if (!controller.is_allowed_callback(callback)) { - return; - } - tracepoint(TRACEPOINT_PROVIDER, rclcpp_subscription_callback_added, - subscription, callback, init_time); + ) { + if (!controller.is_allowed_callback(callback)) { + return; + } + tracepoint( + TRACEPOINT_PROVIDER, rclcpp_subscription_callback_added, + subscription, callback, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "rclcpp_subscription_callback_added," << - subscription << "," << - callback << std::endl; + std::cerr << "rclcpp_subscription_callback_added," << + subscription << "," << + callback << std::endl; #endif - }; + }; auto now = clock.now(); check_and_run_trace_node(); @@ -354,17 +358,19 @@ void ros_trace_rclcpp_timer_callback_added(const void * timer_handle, const void const void * timer_handle, const void * callback, int64_t init_time - ) { - if (!controller.is_allowed_callback(callback)) { - return; - } - tracepoint(TRACEPOINT_PROVIDER, rclcpp_timer_callback_added, timer_handle, callback, init_time); + ) { + if (!controller.is_allowed_callback(callback)) { + return; + } + tracepoint( + TRACEPOINT_PROVIDER, rclcpp_timer_callback_added, timer_handle, callback, + init_time); #ifdef DEBUG_OUTPUT - std::cerr << "rclcpp_timer_callback_added," << - timer_handle << "," << - callback << std::endl; + std::cerr << "rclcpp_timer_callback_added," << + timer_handle << "," << + callback << std::endl; #endif - }; + }; auto now = clock.now(); check_and_run_trace_node(); @@ -389,17 +395,17 @@ void ros_trace_rclcpp_timer_link_node(const void * timer_handle, const void * no const void * timer_handle, const void * node_handle, int64_t init_time - ) { - if (!controller.is_allowed_node(node_handle)) { - return; - } - tracepoint(TRACEPOINT_PROVIDER, rclcpp_timer_link_node, timer_handle, node_handle, init_time); + ) { + if (!controller.is_allowed_node(node_handle)) { + return; + } + tracepoint(TRACEPOINT_PROVIDER, rclcpp_timer_link_node, timer_handle, node_handle, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "rclcpp_timer_link_node," << - timer_handle << "," << - node_handle << std::endl; + std::cerr << "rclcpp_timer_link_node," << + timer_handle << "," << + node_handle << std::endl; #endif - }; + }; auto now = clock.now(); check_and_run_trace_node(); @@ -554,8 +560,8 @@ void ros_trace_rcl_timer_init( // TODO(hsgwa): Add filtering of timer initialization using node_handle static auto record = [](const void * timer_handle, int64_t period, int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, rcl_timer_init, timer_handle, period, init_time); - }; + tracepoint(TRACEPOINT_PROVIDER, rcl_timer_init, timer_handle, period, init_time); + }; auto now = clock.now(); if (!data_container.is_assigned_rcl_timer_init()) { @@ -579,9 +585,9 @@ void ros_trace_rcl_init( static auto & clock = context.get_clock(); static auto & data_container = context.get_data_container(); - static auto record = []( const void * context_handle, int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, rcl_init, context_handle, init_time); - }; + static auto record = [](const void * context_handle, int64_t init_time) { + tracepoint(TRACEPOINT_PROVIDER, rcl_init, context_handle, init_time); + }; auto now = clock.now(); if (!data_container.is_assigned_rcl_init()) { @@ -610,16 +616,17 @@ void ros_trace_rcl_publisher_init( static auto & data_container = context.get_data_container(); static auto & controller = context.get_controller(); - static auto record = []( const void * publisher_handle, - const void * node_handle, - const void * rmw_publisher_handle, - const char * topic_name, - const size_t queue_depth, - int64_t init_time -) { - tracepoint(TRACEPOINT_PROVIDER, rcl_publisher_init, publisher_handle, node_handle, - rmw_publisher_handle, topic_name, queue_depth, init_time); - }; + static auto record = [](const void * publisher_handle, + const void * node_handle, + const void * rmw_publisher_handle, + const char * topic_name, + const size_t queue_depth, + int64_t init_time + ) { + tracepoint( + TRACEPOINT_PROVIDER, rcl_publisher_init, publisher_handle, node_handle, + rmw_publisher_handle, topic_name, queue_depth, init_time); + }; auto now = clock.now(); controller.add_publisher_handle(node_handle, publisher_handle, topic_name); @@ -683,22 +690,23 @@ void ros_trace_rcl_service_init( static auto & context = Singleton::get_instance(); static auto & clock = context.get_clock(); static auto & data_container = context.get_data_container(); - static auto record = []( const void * service_handle, - const void * node_handle, - const void * rmw_service_handle, - const char * service_name, - int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, rcl_service_init, service_handle, - node_handle, rmw_service_handle, service_name, init_time); + static auto record = [](const void * service_handle, + const void * node_handle, + const void * rmw_service_handle, + const char * service_name, + int64_t init_time) { + tracepoint( + TRACEPOINT_PROVIDER, rcl_service_init, service_handle, + node_handle, rmw_service_handle, service_name, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "rcl_service_init," << - service_handle << "," << - node_handle << "," << - rmw_service_handle << "," << - service_name << std::endl; + std::cerr << "rcl_service_init," << + service_handle << "," << + node_handle << "," << + rmw_service_handle << "," << + service_name << std::endl; #endif - }; + }; auto now = clock.now(); if (!data_container.is_assigned_rcl_service_init()) { @@ -720,15 +728,16 @@ void ros_trace_rclcpp_service_callback_added( static auto & clock = context.get_clock(); static auto & data_container = context.get_data_container(); static auto record = [](const void * service_handle, const char * callback, int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, rclcpp_service_callback_added, - service_handle, callback, init_time); + tracepoint( + TRACEPOINT_PROVIDER, rclcpp_service_callback_added, + service_handle, callback, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "rclcpp_service_callback_added," << - service_handle << "," << - callback << std::endl; + std::cerr << "rclcpp_service_callback_added," << + service_handle << "," << + callback << std::endl; #endif - }; + }; auto now = clock.now(); check_and_run_trace_node(); @@ -750,22 +759,23 @@ void ros_trace_rcl_client_init( static auto & context = Singleton::get_instance(); static auto & clock = context.get_clock(); static auto & data_container = context.get_data_container(); - static auto record = []( const void * client_handle, - const void * node_handle, - const void * rmw_client_handle, - const char * service_name, - int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, rcl_client_init, client_handle, node_handle, - rmw_client_handle, service_name, init_time); + static auto record = [](const void * client_handle, + const void * node_handle, + const void * rmw_client_handle, + const char * service_name, + int64_t init_time) { + tracepoint( + TRACEPOINT_PROVIDER, rcl_client_init, client_handle, node_handle, + rmw_client_handle, service_name, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "rcl_client_init," << - client_handle << "," << - node_handle << "," << - rmw_client_handle << "," << - service_name << std::endl; + std::cerr << "rcl_client_init," << + client_handle << "," << + node_handle << "," << + rmw_client_handle << "," << + service_name << std::endl; #endif - }; + }; auto now = clock.now(); if (!data_container.is_assigned_rcl_client_init()) { @@ -792,20 +802,20 @@ void ros_trace_rclcpp_callback_register( const void * callback, const char * symbol, int64_t init_time - ) { - static auto & context = Singleton::get_instance(); - static auto & controller = context.get_controller(); - if (!controller.is_allowed_callback(callback)) { - return; - } - tracepoint(TRACEPOINT_PROVIDER, rclcpp_callback_register, callback, symbol, init_time); + ) { + static auto & context = Singleton::get_instance(); + static auto & controller = context.get_controller(); + if (!controller.is_allowed_callback(callback)) { + return; + } + tracepoint(TRACEPOINT_PROVIDER, rclcpp_callback_register, callback, symbol, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "rclcpp_callback_register," << - callback << "," << - symbol << std::endl; + std::cerr << "rclcpp_callback_register," << + callback << "," << + symbol << std::endl; #endif - }; + }; auto now = clock.now(); check_and_run_trace_node(); @@ -829,15 +839,16 @@ void ros_trace_rcl_lifecycle_state_machine_init( const void * node_handle, const void * state_machine, int64_t init_time) { - tracepoint(TRACEPOINT_PROVIDER, rcl_lifecycle_state_machine_init, - node_handle, state_machine, init_time); + tracepoint( + TRACEPOINT_PROVIDER, rcl_lifecycle_state_machine_init, + node_handle, state_machine, init_time); #ifdef DEBUG_OUTPUT - std::cerr << "rcl_lifecycle_state_machine_init," << - node_handle << "," << - state_machine << std::endl; + std::cerr << "rcl_lifecycle_state_machine_init," << + node_handle << "," << + state_machine << std::endl; #endif - }; + }; auto now = clock.now(); check_and_run_trace_node(); @@ -942,15 +953,16 @@ void ros_trace_rmw_take( if (controller.is_allowed_rmw_subscription_handle(rmw_subscription_handle) && context.is_recording_allowed()) { - ((functionT) orig_func)(rmw_subscription_handle, message, + ((functionT) orig_func)( + rmw_subscription_handle, message, source_timestamp, taken); #ifdef DEBUG_OUTPUT - std::cerr << "rmw_take," << - rmw_subscription_handle << "," << - message << "," << - source_timestamp << "," << - taken << "," << std::endl; + std::cerr << "rmw_take," << + rmw_subscription_handle << "," << + message << "," << + source_timestamp << "," << + taken << "," << std::endl; #endif } } diff --git a/CARET_trace/src/singleton.cpp b/CARET_trace/src/singleton.cpp old mode 100644 new mode 100755 diff --git a/CARET_trace/src/tp.c b/CARET_trace/src/tp.c old mode 100644 new mode 100755 diff --git a/CARET_trace/src/trace_node.cpp b/CARET_trace/src/trace_node.cpp old mode 100644 new mode 100755 diff --git a/CARET_trace/src/tracing_controller.cpp b/CARET_trace/src/tracing_controller.cpp old mode 100644 new mode 100755 diff --git a/CARET_trace/test/CMakeLists.txt b/CARET_trace/test/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/CARET_trace/test/common.cpp b/CARET_trace/test/common.cpp old mode 100644 new mode 100755 diff --git a/CARET_trace/test/include/test/common.hpp b/CARET_trace/test/include/test/common.hpp old mode 100644 new mode 100755 diff --git a/CARET_trace/test/include/test/mock.hpp b/CARET_trace/test/include/test/mock.hpp old mode 100644 new mode 100755 index b7da1be8..658a2ea2 --- a/CARET_trace/test/include/test/mock.hpp +++ b/CARET_trace/test/include/test/mock.hpp @@ -32,8 +32,8 @@ class CaretTraceNodeModeMock : public TraceNodeInterface MOCK_CONST_METHOD0(is_recording_allowed, bool()); MOCK_CONST_METHOD0(is_recording_allowed_init, bool()); MOCK_CONST_METHOD0(is_timer_running, bool()); - MOCK_METHOD0(get_data_container, DataContainerInterface &()); - MOCK_CONST_METHOD0(get_status, const TRACE_STATUS &()); + MOCK_METHOD0(get_data_container, DataContainerInterface & ()); + MOCK_CONST_METHOD0(get_status, const TRACE_STATUS & ()); }; /// @private diff --git a/CARET_trace/test/test_context.cpp b/CARET_trace/test/test_context.cpp old mode 100644 new mode 100755 diff --git a/CARET_trace/test/test_data_container.cpp b/CARET_trace/test/test_data_container.cpp old mode 100644 new mode 100755 index 3a5e944a..73945f3d --- a/CARET_trace/test/test_data_container.cpp +++ b/CARET_trace/test/test_data_container.cpp @@ -67,27 +67,27 @@ TEST(DataContainerTest, TracePoints) std::vector expect( {"add_callback_group", - "add_callback_group_static_executor", - "callback_group_add_client", - "callback_group_add_service", - "callback_group_add_subscription", - "callback_group_add_timer", - "construct_executor", - "construct_static_executor", - "rcl_client_init", - "rcl_init", - "rcl_node_init", - "rcl_publisher_init", - "rcl_service_init", - "rcl_subscription_init", - "rcl_timer_init", - "rclcpp_callback_register", - "rclcpp_service_callback_added", - "rclcpp_subscription_callback_added", - "rclcpp_subscription_init", - "rclcpp_timer_callback_added", - "rclcpp_timer_link_node", - "rmw_implementation"}); + "add_callback_group_static_executor", + "callback_group_add_client", + "callback_group_add_service", + "callback_group_add_subscription", + "callback_group_add_timer", + "construct_executor", + "construct_static_executor", + "rcl_client_init", + "rcl_init", + "rcl_node_init", + "rcl_publisher_init", + "rcl_service_init", + "rcl_subscription_init", + "rcl_timer_init", + "rclcpp_callback_register", + "rclcpp_service_callback_added", + "rclcpp_subscription_callback_added", + "rclcpp_subscription_init", + "rclcpp_timer_callback_added", + "rclcpp_timer_link_node", + "rmw_implementation"}); EXPECT_EQ(trace_points, expect); } diff --git a/CARET_trace/test/test_data_recorder.cpp b/CARET_trace/test/test_data_recorder.cpp old mode 100644 new mode 100755 index bc702b36..607241df --- a/CARET_trace/test/test_data_recorder.cpp +++ b/CARET_trace/test/test_data_recorder.cpp @@ -40,10 +40,11 @@ TEST(DataRecorderTest, AssignCaseOneKeys) DataRecorder recorder({key}); bool called = false; - key->assign([&](const int arg) { - (void)arg; - called = true; - }); + key->assign( + [&](const int arg) { + (void)arg; + called = true; + }); key->store(0); diff --git a/CARET_trace/test/test_hashable_keys.cpp b/CARET_trace/test/test_hashable_keys.cpp old mode 100644 new mode 100755 index 43159b79..1e469a06 --- a/CARET_trace/test/test_hashable_keys.cpp +++ b/CARET_trace/test/test_hashable_keys.cpp @@ -127,8 +127,8 @@ TEST(HashableKeys, StringLiteralCase) HashableKeys keys__(s__); auto is_equal = [](const char * lhs, const char * rhs) -> bool { - return std::string(lhs).compare(rhs) == 0; - }; + return std::string(lhs).compare(rhs) == 0; + }; EXPECT_TRUE(is_equal(keys.first(), keys_.first())); EXPECT_FALSE(is_equal(keys.first(), keys__.first())); diff --git a/CARET_trace/test/test_recordable_data.cpp b/CARET_trace/test/test_recordable_data.cpp old mode 100644 new mode 100755 index 1b775c4d..099e16be --- a/CARET_trace/test/test_recordable_data.cpp +++ b/CARET_trace/test/test_recordable_data.cpp @@ -63,8 +63,8 @@ TEST(RecordableData, TwoTypesCase) EXPECT_EQ(set->get().first(), 1); auto is_equal = [](const char * lhs, const char * rhs) -> bool { - return std::string(lhs).compare(rhs) == 0; - }; + return std::string(lhs).compare(rhs) == 0; + }; EXPECT_TRUE(is_equal(set->get().second(), "test")); diff --git a/CARET_trace/test/test_scenario.cpp b/CARET_trace/test/test_scenario.cpp old mode 100644 new mode 100755 index 2071608f..460ec469 --- a/CARET_trace/test/test_scenario.cpp +++ b/CARET_trace/test/test_scenario.cpp @@ -101,8 +101,8 @@ TEST(ScenarioTest, TestMultiThread) // NOTE: Ensure recording data. Avoid container.record() before add_data() is called. add_data(container, 1); - std::thread t1([&container, loop]() { add_data(container, loop); }); - std::thread t2([&container, loop]() { container.record(loop); }); + std::thread t1([&container, loop]() {add_data(container, loop);}); + std::thread t2([&container, loop]() {container.record(loop);}); t1.join(); t2.join(); diff --git a/CARET_trace/test/test_trace_node.cpp b/CARET_trace/test/test_trace_node.cpp old mode 100644 new mode 100755