geopm
3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
|
#include "StatsCollector.hpp"
#include "geopm_stats_collector.h"
#include <sstream>
#include <cmath>
#include <cstring>
#include "geopm/Exception.hpp"
#include "geopm/Helper.hpp"
#include "geopm/PlatformIO.hpp"
#include "geopm/PlatformTopo.hpp"
#include "geopm_time.h"
#include "RuntimeStats.hpp"
Namespaces | |
geopm | |
Functions | |
int | geopm_stats_collector_create (size_t num_requests, const struct geopm_request_s *requests, struct geopm_stats_collector_s **collector) |
Create a stats collector handle. More... | |
int | geopm_stats_collector_update (struct geopm_stats_collector_s *collector) |
Update a stat collector with new values. More... | |
int | geopm_stats_collector_update_count (const struct geopm_stats_collector_s *collector, size_t *update_count) |
Number of updates since last reset. More... | |
int | geopm_stats_collector_report_yaml (const struct geopm_stats_collector_s *collector, size_t *max_report_size, char *report_yaml) |
Create a yaml report. More... | |
int | geopm_stats_collector_report (const struct geopm_stats_collector_s *collector, size_t num_requests, geopm_report_s *report) |
int | geopm_stats_collector_reset (struct geopm_stats_collector_s *collector) |
Reset statistics. More... | |
int | geopm_stats_collector_free (struct geopm_stats_collector_s *collector) |
Release resources associated with collector handle. More... | |
int geopm_stats_collector_create | ( | size_t | num_requests, |
const struct geopm_request_s * | requests, | ||
struct geopm_stats_collector_s ** | collector | ||
) |
Create a stats collector handle.
Provide a list of PlatformIO signal requests and construct a stats collector object. The request list determine which statistics will be included in the generated report.
[in] | num_requests | Number of requests in array pointed to by the request pointer |
[in] | requests | Array of PlatformIO signal requests that configures the report contents |
[out] | collector | Handle to the constructed StatsCollector object, must be de-allocated with geopm_stats_collector_free() |
int geopm_stats_collector_free | ( | struct geopm_stats_collector_s * | collector | ) |
Release resources associated with collector handle.
[in] | collector | Handle created with a call to geopm_stats_collector_create() |
int geopm_stats_collector_report | ( | const struct geopm_stats_collector_s * | collector, |
size_t | num_requests, | ||
geopm_report_s * | report | ||
) |
int geopm_stats_collector_report_yaml | ( | const struct geopm_stats_collector_s * | collector, |
size_t * | max_report_size, | ||
char * | report_yaml | ||
) |
Create a yaml report.
Create a report that shows all statistics gathered by calls to geopm_stats_collector_update(). To determine the size of the report string, call with *max_report_size == 0 and report_yaml == NULL. In this case max_report_size will be updated with the required string length and zero is returned. Otherwise, if *max_report_size provided by the user is not sufficient, EINVAL is returned and the value of *max_report_size is set to the required size and report_yaml is unmodified.
[in] | collector | Handle created with a call to geopm_stats_collector_create() |
[in,out] | max_report_size | Set to the length of the report_yaml string provided by the user, set to zero to query value. If too small, will be updated with required value. |
[out] | report_yaml | Generated report string allocated by the user, set to NULL to query max_report_size without error. |
int geopm_stats_collector_reset | ( | struct geopm_stats_collector_s * | collector | ) |
Reset statistics.
Called by user to zero all statistics gathered. This may be called after a call to geopm_stats_collector_report_yaml() and before the next call to geopm_stats_collector_update() so that the next report that is generated is independent of the last.
[in] | collector | Handle created with a call to geopm_stats_collector_create() |
int geopm_stats_collector_update | ( | struct geopm_stats_collector_s * | collector | ) |
Update a stat collector with new values.
User is expected to call PlatformIO::read_batch() prior to calling this interface. The sampled values will be used to update the report statistics.
[in] | collector | Handle created with a call to geopm_stats_collector_create() |
int geopm_stats_collector_update_count | ( | const struct geopm_stats_collector_s * | collector, |
size_t * | update_count | ||
) |
Number of updates since last reset.
Sets update_count to the number of times that the geopm_stats_collector_update() function has been called on the collector object since it was created, or since the last call to geopm_stats_collector_reset().
[in] | collector | Handle created with a call to geopm_stats_collector_create() |
[out] | update_count | Set to the number of updates upon successful completion |