com.bigdata.counters.linux
Class PIDStatCollector
java.lang.Object
com.bigdata.counters.AbstractProcessCollector
com.bigdata.counters.linux.PIDStatCollector
- All Implemented Interfaces:
- ICounterHierarchy, IProcessCounters, IStatisticsCollector
public class PIDStatCollector
- extends AbstractProcessCollector
- implements ICounterHierarchy, IProcessCounters
Collects statistics on the JVM process relating to CPU, memory, and IO
statistics (when available) using pidstat -p 501 -u -I -r -d -w [[interval [count]]
Where -p is the pid to montitor -u is cpi (-I normalizes to 100% for SMP), -r
is memory stats, -d gives IO statistics with kernels 2.6.20 and up; -w is
context switching data; The interval is in seconds. The count is optional -
when missing or zero will repeat forever if interval was specified.
- Version:
- $Id: PIDStatCollector.java 2265 2009-10-26 12:51:06Z thompsonbry $
- Author:
- Bryan Thompson
|
Field Summary |
protected boolean |
perProcessIOData
set true if per-process IO data collection should be
supported based on the KernelVersion. |
protected int |
pid
process to be monitored. |
| Fields inherited from interface com.bigdata.counters.IProcessCounters |
CPU_PercentProcessorTime, CPU_PercentSystemTime, CPU_PercentUserTime, Memory_majorFaultsPerSec, Memory_minorFaultsPerSec, Memory_percentMemorySize, Memory_residentSetSize, Memory_runtimeFreeMemory, Memory_runtimeMaxMemory, Memory_runtimeTotalMemory, Memory_virtualSize, PhysicalDisk_BytesReadPerSec, PhysicalDisk_BytesWrittenPerSec |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
pid
protected final int pid
- process to be monitored.
perProcessIOData
protected final boolean perProcessIOData
- set
true if per-process IO data collection should be
supported based on the KernelVersion.
PIDStatCollector
public PIDStatCollector(int pid,
int interval,
KernelVersion kernelVersion)
- Parameters:
pid - Process to be monitored.interval - Reporting interval in seconds.kernelVersion - The Linux KernelVersion.- TODO:
- kernelVersion could be static.
getCommand
public List<String> getCommand()
- Specified by:
getCommand in class AbstractProcessCollector
getCounters
public CounterSet getCounters()
- Declare the counters that we will collect using
pidstat.
These counters are NOT placed within the counter hierarchy but are
declared using the bare path for the counter. E.g., as
IProcessCounters.Memory_virtualSize.
- Specified by:
getCounters in interface IStatisticsCollector
setEnvironment
protected void setEnvironment(Map<String,String> env)
- Extended to force
pidstat to use a consistent
timestamp format regardless of locale by setting
S_TIME_FORMAT="ISO" in the environment.
- Overrides:
setEnvironment in class AbstractProcessCollector
getProcessReader
public AbstractProcessReader getProcessReader()
- Specified by:
getProcessReader in class AbstractProcessCollector
Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.