CPUSegment.h
Go to the documentation of this file.
1
#pragma once
2
3
// STD/STL
4
#include <atomic>
5
#include <csignal>
6
#include <iostream>
7
#include <memory>
8
#include <thread>
9
10
// System Monitor
11
#include "
LightweightSystemMonitor/linux_cpuload.hpp
"
12
#include "
LightweightSystemMonitor/linux_memoryload.hpp
"
13
#include "
LightweightSystemMonitor/linux_networkload.hpp
"
14
#include "
LightweightSystemMonitor/linux_process_load.hpp
"
15
#include "
LightweightSystemMonitor/linux_systemutil.hpp
"
16
#include "
LightweightSystemMonitor/util/record_value.hpp
"
17
#include "
LightweightSystemMonitor/util/timer.hpp
"
18
19
// BaseClass
20
#include <
RobotAPI/libraries/armem/server/segment/SpecializedProviderSegment.h
>
21
22
// ArmarX
23
#include <
ArmarXCore/core/services/tasks/PeriodicTask.h
>
24
25
namespace
armarx::armem::server::systemstate::segment
26
{
27
class
LightweightCpuMonitorProviderSegment
:
28
public
armem::server::segment::SpecializedProviderSegment
29
{
30
using
Base
=
armem::server::segment::SpecializedProviderSegment
;
31
32
public
:
33
LightweightCpuMonitorProviderSegment
(
armem::server::MemoryToIceAdapter
&
iceMemory
);
34
35
void
defineProperties
(
armarx::PropertyDefinitionsPtr
defs,
36
const
std::string& prefix =
""
)
override
;
37
void
init
()
override
;
38
39
private
:
40
void
loop();
41
42
private
:
43
float
pollFrequencyHz = 10.0;
44
std::unique_ptr<cpuLoad> cpuMonitoring = std::make_unique<cpuLoad>(
"/proc/stat"
);
45
46
armarx::PeriodicTask<LightweightCpuMonitorProviderSegment>::pointer_type
runningTask;
47
};
48
}
// namespace armarx::armem::server::systemstate::segment
linux_memoryload.hpp
armarx::armem::server::systemstate::segment::LightweightCpuMonitorProviderSegment::LightweightCpuMonitorProviderSegment
LightweightCpuMonitorProviderSegment(armem::server::MemoryToIceAdapter &iceMemory)
Definition:
CPUSegment.cpp:15
armarx::armem::server::MemoryToIceAdapter
Helps connecting a Memory server to the Ice interface.
Definition:
MemoryToIceAdapter.h:19
linux_cpuload.hpp
PeriodicTask.h
armarx::armem::server::segment::SpecializedProviderSegment
A base class for provider segments.
Definition:
SpecializedProviderSegment.h:19
linux_process_load.hpp
linux_systemutil.hpp
timer.hpp
armarx::armem::server::systemstate::segment::LightweightCpuMonitorProviderSegment
Definition:
CPUSegment.h:27
armarx::armem::server::segment::detail::SegmentBase< server::wm::ProviderSegment >
linux_networkload.hpp
armarx::armem::server::systemstate::segment::LightweightCpuMonitorProviderSegment::init
void init() override
Definition:
CPUSegment.cpp:29
armarx::armem::server::segment::detail::SegmentBase< server::wm::ProviderSegment >::iceMemory
MemoryToIceAdapter & iceMemory
Definition:
SpecializedSegment.h:58
armarx::armem::server::systemstate::segment::LightweightCpuMonitorProviderSegment::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
Definition:
CPUSegment.cpp:22
IceUtil::Handle< class PropertyDefinitionContainer >
SpecializedProviderSegment.h
record_value.hpp
armarx::armem::server::systemstate::segment
Definition:
CPUSegment.cpp:13
RobotAPI
libraries
armem_system_state
server
CPUSegment.h
Generated on Sat Mar 29 2025 09:17:29 for armarx_documentation by
1.8.17