Package org.jppf.management.diagnostics
Class CPUTimeCollector
java.lang.Object
org.jppf.utils.concurrent.ThreadSynchronization
org.jppf.management.diagnostics.CPUTimeCollector
- All Implemented Interfaces:
Runnable
This class computes, at regular intervals, the approximative value of the CPU load
for the current JVM.
The computed value is equal to sumi(thread_used_cpui) / interval, for all the
live threads of the JVM at the time of the computation.
Thus, errors may occur, since many threads may have been created then died between two computations. However, in most cases this is a reasonable approximation, whose computation does not tax the CPU too heavily.
- Author:
- Laurent Cohen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static longThe interval between two computations in milliseconds.Fields inherited from class org.jppf.utils.concurrent.ThreadSynchronization
stopped -
Method Summary
Modifier and TypeMethodDescriptionstatic CPUTimeCollectordoublegetLoad()Get the CPU load as the ratio oftotalCpuTime / computationInterval.voidrun()Methods inherited from class org.jppf.utils.concurrent.ThreadSynchronization
goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUp
-
Field Details
-
INTERVAL
protected static long INTERVALThe interval between two computations in milliseconds. Taken from the value of configuration property "jppf.cpu.load.compuation.interval". It defaults to 1000 (1 second) if the property is unspecified.
-
-
Method Details