6 #ifndef STATSCOLLECTOR_HPP_INCLUDE
7 #define STATSCOLLECTOR_HPP_INCLUDE
30 std::vector<std::array<double, GEOPM_NUM_METRIC_STATS> >
metric_stats;
42 static std::unique_ptr<StatsCollector>
make_unique(
const std::vector<geopm_request_s> &requests);
99 void update(
void)
override;
101 void reset(
void)
override;
105 std::vector<std::string> register_requests(
const std::vector<geopm_request_s> &requests);
106 std::string report_yaml_curr(
void)
const;
108 std::vector<std::string> m_metric_names;
109 std::vector<int> m_pio_idx;
110 std::shared_ptr<RuntimeStats> m_stats;
112 size_t m_update_count;
113 double m_time_sample;
114 double m_time_delta_m_1;
115 double m_time_delta_m_2;
116 std::string m_time_begin_str;
118 mutable bool m_is_cached;
119 mutable std::string m_report_cache;
Class that accumulates statistics based on PlatformIO requests.
Definition: StatsCollector.hpp:23
virtual report_s report_struct(void) const =0
Return report of statistics in a structure representation.
virtual void update(void)=0
Sample PlatformIO and update all tracked signals.
virtual ~StatsCollector()=default
Default destructor.
virtual size_t update_count(void) const =0
Number of updates since last reset.
StatsCollector()=default
Default null constructor without requests.
virtual std::string report_yaml(void) const =0
Generate a YAML report of statistics.
virtual void reset(void)=0
May be called after report_yaml() to reset statistics.
static std::unique_ptr< StatsCollector > make_unique(const std::vector< geopm_request_s > &requests)
Factory access method.
Definition: StatsCollector.cpp:24
Definition: StatsCollector.hpp:83
StatsCollectorImp()
Default null constructor without requests.
Definition: StatsCollector.cpp:29
std::string report_yaml(void) const override
Generate a YAML report of statistics.
Definition: StatsCollector.cpp:107
size_t update_count(void) const override
Number of updates since last reset.
Definition: StatsCollector.cpp:205
void reset(void) override
May be called after report_yaml() to reset statistics.
Definition: StatsCollector.cpp:193
~StatsCollectorImp()=default
Default destructor.
void update(void) override
Sample PlatformIO and update all tracked signals.
Definition: StatsCollector.cpp:72
report_s report_struct(void) const override
Return report of statistics in a structure representation.
Definition: StatsCollector.cpp:116
Definition: StatsCollector.hpp:25
std::vector< std::string > metric_names
Definition: StatsCollector.hpp:29
std::string host
Definition: StatsCollector.hpp:26
std::vector< std::array< double, GEOPM_NUM_METRIC_STATS > > metric_stats
Definition: StatsCollector.hpp:30
std::array< double, GEOPM_NUM_SAMPLE_STATS > sample_stats
Definition: StatsCollector.hpp:28
std::string sample_time_first
Definition: StatsCollector.hpp:27