Package pulse.util
Class ResourceMonitor
- java.lang.Object
-
- pulse.util.ResourceMonitor
-
public class ResourceMonitor extends Object
Provides unified means of storage and methods of access to runtime system information, such as CPU usage, memory usage, an number of available threads.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcpuUsage()This will calculate the CPU load for the machine runningPULsE.doublegetCpuUsage()static ResourceMonitorgetInstance()doublegetMemoryUsage()intgetThreadsAvailable()voidmemoryUsage()This will calculate the ratiototalMemory/maxMemoryusing the standardRuntime.voidthreadsAvailable()Finds the number of threads available for calculation.voidupdate()
-
-
-
Method Detail
-
update
public void update()
-
memoryUsage
public void memoryUsage()
This will calculate the ratio
totalMemory/maxMemoryusing the standardRuntime. Note this memory usage depends on heap allocation for the JVM.
-
cpuUsage
public void cpuUsage()
This will calculate the CPU load for the machine running
PULsE. Note this is rather code-intensive, so it is recommended for use only at certain time intervals.
-
threadsAvailable
public void threadsAvailable()
Finds the number of threads available for calculation. This will be used by theTaskManagerwhen allocating theForkJoinPoolfor running several tasks in parallel. The number of threads is greater or equal to the number of cores- See Also:
TaskManager
-
getCpuUsage
public double getCpuUsage()
-
getThreadsAvailable
public int getThreadsAvailable()
-
getMemoryUsage
public double getMemoryUsage()
-
getInstance
public static ResourceMonitor getInstance()
-
-