libstatistics_collector  master
Lightweight aggregation utilities to collect statistics and measure message metrics.
Classes | Functions
libstatistics_collector::collector Namespace Reference

Classes

class  Collector
 
class  MetricDetailsInterface
 

Functions

statistics_msgs::msg::MetricsMessage GenerateStatisticMessage (const std::string &node_name, const std::string &metric_name, const std::string &unit, const builtin_interfaces::msg::Time window_start, const builtin_interfaces::msg::Time window_stop, const libstatistics_collector::moving_average_statistics::StatisticData &data)
 

Function Documentation

◆ GenerateStatisticMessage()

statistics_msgs::msg::MetricsMessage libstatistics_collector::collector::GenerateStatisticMessage ( const std::string &  node_name,
const std::string &  metric_name,
const std::string &  unit,
const builtin_interfaces::msg::Time  window_start,
const builtin_interfaces::msg::Time  window_stop,
const libstatistics_collector::moving_average_statistics::StatisticData data 
)

Return a valid MetricsMessage ready to be published to a ROS topic

Parameters
node_namethe name of the node that the data originates from
metric_namethe name of the metric ("cpu_usage", "memory_usage", etc.)
unitname of the unit ("percentage", "mb", etc.)
window_startmeasurement window start time
window_stopmeasurement window end time
datastatistics derived from the measurements made in the window
Returns
a MetricsMessage containing the statistics in the data parameter