Class HealthServiceImpl
- java.lang.Object
-
- com.microej.kernel.green.monitoring.HealthServiceImpl
-
- All Implemented Interfaces:
HealthService
,ej.kf.FeatureStateListener
public class HealthServiceImpl extends java.lang.Object implements HealthService, ej.kf.FeatureStateListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HealthServiceImpl.MonitoringTask
-
Constructor Summary
Constructors Constructor Description HealthServiceImpl(ej.bon.Timer timer, long intervalMS, boolean runGcBeforeCollecting)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getFreeMemory()
long
getMaxMemory()
long
getTotalMemory()
ej.basictool.map.PackedMap<java.lang.String,java.lang.Float>
getUsedCpuPercentPerModule()
Retrieves the CPU usage for each module from the previous monitoring cycle, expressed as a percentage.ej.basictool.map.PackedMap<java.lang.String,java.lang.Float>
getUsedMemoryPercentPerModule()
Retrieves the RAM usage values expressed as a percentage (a value between 0 and 1.0).ej.basictool.map.PackedMap<java.lang.String,java.lang.Long>
getUsedMemoryPerModule()
Retrieves the current RAM usage for each module.void
start()
void
stateChanged(ej.kf.Feature app, ej.kf.Feature.State state)
void
stop()
-
-
-
Method Detail
-
start
public void start()
-
stop
public void stop()
-
stateChanged
public void stateChanged(ej.kf.Feature app, @Nullable ej.kf.Feature.State state)
- Specified by:
stateChanged
in interfaceej.kf.FeatureStateListener
-
getUsedCpuPercentPerModule
public ej.basictool.map.PackedMap<java.lang.String,java.lang.Float> getUsedCpuPercentPerModule()
Description copied from interface:HealthService
Retrieves the CPU usage for each module from the previous monitoring cycle, expressed as a percentage.- Specified by:
getUsedCpuPercentPerModule
in interfaceHealthService
- Returns:
- A map where each entry contains a module name as the key and its CPU usage percentage (0.0 to 1.0) as the value.
-
getUsedMemoryPerModule
public ej.basictool.map.PackedMap<java.lang.String,java.lang.Long> getUsedMemoryPerModule()
Description copied from interface:HealthService
Retrieves the current RAM usage for each module.- Specified by:
getUsedMemoryPerModule
in interfaceHealthService
- Returns:
- A map where each entry contains a module identifier as the key and its current RAM usage in bytes as the value.
-
getUsedMemoryPercentPerModule
public ej.basictool.map.PackedMap<java.lang.String,java.lang.Float> getUsedMemoryPercentPerModule()
Description copied from interface:HealthService
Retrieves the RAM usage values expressed as a percentage (a value between 0 and 1.0).The percentage indicates the ratio between a module's current heap consumption and the total heap.
- Specified by:
getUsedMemoryPercentPerModule
in interfaceHealthService
- Returns:
- A map where each entry contains the module name as the key and its current RAM usage percentage as the value.
-
getFreeMemory
public long getFreeMemory()
- Specified by:
getFreeMemory
in interfaceHealthService
- Returns:
- Free Memory
-
getMaxMemory
public long getMaxMemory()
- Specified by:
getMaxMemory
in interfaceHealthService
- Returns:
- return max memory
-
getTotalMemory
public long getTotalMemory()
- Specified by:
getTotalMemory
in interfaceHealthService
- Returns:
- total memory
-
-