21#include <sys/sysinfo.h>
36 enum class load_type : uint8_t { AVG_1_MIN, AVG_5_MIN, AVG_15_MIN };
39 static constexpr char LOG_TAG[] =
"diagnostics_metric_cpu_load";
41 static constexpr std::array<std::string_view, LOAD_COUNT>
LOAD_LABELS
42 = {
"1Min",
"5Min",
"15Min"};
71 "Failed to retrieve sysinfo. err: %d, errono: %d",
82 ss << std::fixed << std::setprecision(2) <<
load_list[i];
Definition: zigpc_cpu_load_metric.hpp:30
static constexpr int LOAD_COUNT
Definition: zigpc_cpu_load_metric.hpp:40
std::array< double, LOAD_COUNT > load_list
Definition: zigpc_cpu_load_metric.hpp:44
zigpc_cpu_load_metric(zigpc_diagnostics_notification ¬if, std::string metric_id)
Definition: zigpc_cpu_load_metric.hpp:47
load_type
CPU Load average types.
Definition: zigpc_cpu_load_metric.hpp:36
static constexpr std::array< std::string_view, LOAD_COUNT > LOAD_LABELS
Definition: zigpc_cpu_load_metric.hpp:42
double get_value(load_type type) const
Definition: zigpc_cpu_load_metric.hpp:52
static constexpr char LOG_TAG[]
Definition: zigpc_cpu_load_metric.hpp:39
void update_value()
Definition: zigpc_cpu_load_metric.hpp:66
Abstract top level metric from which all diagnostic metric derive from.
Definition: zigpc_diagnostics_metric.hpp:25
zigpc_diagnostics_notification & on_update_complete
Definition: zigpc_diagnostics_metric.hpp:28
std::string serialized_value
Definition: zigpc_diagnostics_metric.hpp:30
std::string metric_id
Definition: zigpc_diagnostics_metric.hpp:29
Definition: zigpc_diagnostics_notification.hpp:20
virtual void notify(std::string metric_id)
Definition: zigpc_diagnostics_notification.hpp:22
#define sl_log_error(tag, fmtstr,...)
Definition: sl_log.h:145