libstatistics_collector
master
Lightweight aggregation utilities to collect statistics and measure message metrics.
|
Go to the documentation of this file.
15 #ifndef LIBSTATISTICS_COLLECTOR__TOPIC_STATISTICS_COLLECTOR__RECEIVED_MESSAGE_PERIOD_HPP_
16 #define LIBSTATISTICS_COLLECTOR__TOPIC_STATISTICS_COLLECTOR__RECEIVED_MESSAGE_PERIOD_HPP_
29 namespace topic_statistics_collector
50 ResetTimeLastMessageReceived();
62 void OnMessageReceived(
const T & received_message,
const rcl_time_point_value_t now_nanoseconds)
63 override RCPPUTILS_TSA_REQUIRES(mutex_)
65 std::unique_lock<std::mutex> ulock{mutex_};
67 (void) received_message;
70 time_last_message_received_ = now_nanoseconds;
72 const std::chrono::nanoseconds nanos{now_nanoseconds - time_last_message_received_};
73 const auto period = std::chrono::duration_cast<std::chrono::milliseconds>(nanos);
74 time_last_message_received_ = now_nanoseconds;
106 ResetTimeLastMessageReceived();
119 void ResetTimeLastMessageReceived()
127 rcl_time_point_value_t time_last_message_received_ RCPPUTILS_TSA_GUARDED_BY(mutex_) =
129 mutable std::mutex mutex_;
135 #endif // LIBSTATISTICS_COLLECTOR__TOPIC_STATISTICS_COLLECTOR__RECEIVED_MESSAGE_PERIOD_HPP_
std::string GetMetricUnit() const override
Definition: received_message_period.hpp:94
Definition: topic_statistics_collector.hpp:37
std::string GetMetricName() const override
Definition: received_message_period.hpp:84
constexpr const int64_t kUninitializedTime
Definition: received_message_period.hpp:32
Definition: collector.hpp:29
bool SetupStop() override
Definition: received_message_period.hpp:110
bool SetupStart() override
Definition: received_message_period.hpp:104
constexpr const char kMillisecondUnitName[]
Definition: constants.hpp:29
virtual ~ReceivedMessagePeriodCollector()=default
void OnMessageReceived(const T &received_message, const rcl_time_point_value_t now_nanoseconds) override RCPPUTILS_TSA_REQUIRES(mutex_)
Definition: received_message_period.hpp:62
constexpr const char kMsgPeriodStatName[]
Definition: constants.hpp:28
ReceivedMessagePeriodCollector()
Definition: received_message_period.hpp:48
virtual void AcceptData(const double measurement)
Definition: received_message_period.hpp:41