17 Base(
iceMemory,
"LightweightSystemMonitor",
"MemoryUsage", nullptr, nullptr, 1000)
23 const std::string& prefix)
25 defs->optional(pollFrequencyHz, prefix +
"pollFrequencyHz",
"The poll frequency in Hz");
33 pollFrequencyHz = std::clamp(pollFrequencyHz, 0.1f, 100.f);
38 this, &LightweightRamMonitorProviderSegment::loop, (1000.f / pollFrequencyHz));
43 LightweightRamMonitorProviderSegment::loop()
49 long total = memoryMonitoring->getTotalMemoryInKB();
50 double usage = memoryMonitoring->getCurrentMemUsageInPercent();
52 auto data = std::make_shared<aron::data::Dict>();
53 data->addElement(
"total",
54 std::make_shared<aron::data::Long>(total));
55 data->addElement(
"load", std::make_shared<aron::data::Double>(usage));
57 ARMARX_DEBUG <<
"RAM Usage is: " << usage <<
"% (of " << total <<
"KB max)";
61 update.confidence = 1.0;
63 update.instancesData = {
data};
The periodic task executes one thread method repeatedly using the time period specified in the constr...
MemoryID withEntityName(const std::string &name) const
UpdateResult update(const EntityUpdate &update)
Updates an entity's history.
Helps connecting a Memory server to the Ice interface.
virtual void init() override
MemoryToIceAdapter & iceMemory
server::wm::ProviderSegment * segmentPtr
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
LightweightRamMonitorProviderSegment(armem::server::MemoryToIceAdapter &iceMemory)
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
An update of an entity for a specific point in time.