public class CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics>
This data is read from /proc/<pid>/stat
-- see the corresponding man page for details.
Modifier and Type | Field and Description |
---|---|
protected static long |
DEFAULT_CLOCK_TICKS_PER_SECOND |
Constructor and Description |
---|
CpuMetricsCollector() |
Modifier and Type | Method and Description |
---|---|
CpuMetrics |
createMetrics()
Creates an empty instance of the corresponding system metrics.
|
boolean |
getSnapshot(CpuMetrics snapshot)
Note that access to snapshot instances is not synchronized and must be taken care of
by the caller requesting getSnapshot.
|
protected java.lang.String |
readProcFile() |
protected static final long DEFAULT_CLOCK_TICKS_PER_SECOND
public boolean getSnapshot(CpuMetrics snapshot)
SystemMetricsCollector
getSnapshot
in class SystemMetricsCollector<CpuMetrics>
snapshot
- snapshot on which the data will be writtenpublic CpuMetrics createMetrics()
SystemMetricsCollector
Explicitly having this function available reduces a significant amount of boilerplate
createMetrics
in class SystemMetricsCollector<CpuMetrics>
@Nullable protected java.lang.String readProcFile()