17 Base(iceMemory,
"LightweightSystemMonitor",
"CPUUsage", nullptr, nullptr, 1000)
24 defs->optional(pollFrequencyHz, prefix +
"pollFrequencyHz",
"The poll frequency in Hz");
31 pollFrequencyHz =
std::clamp(pollFrequencyHz, 0.1f, 100.f);
32 cpuMonitoring->initCpuUsage();
34 float sleepTime = (1000.f / pollFrequencyHz);
40 void LightweightCpuMonitorProviderSegment::loop()
46 double usage = cpuMonitoring->getCurrentCpuUsage();
47 std::string model = cpuMonitoring->getCPUName();
48 std::vector<double> cores = cpuMonitoring->getCurrentMultiCoreUsage();
50 auto data = std::make_shared<aron::data::Dict>();
51 data->addElement(
"model", std::make_shared<aron::data::String>(model));
52 data->addElement(
"load", std::make_shared<aron::data::Double>(usage));
54 auto list = std::make_shared<aron::data::List>();
55 for (
const auto core : cores)
57 list->addElement(std::make_shared<aron::data::Double>(core));
61 ARMARX_DEBUG <<
"Current CPU load: " << usage <<
" (of model: " << model <<
")";