com.bigdata.counters.linux
Class PIDStatCollector.PIDStatReader

java.lang.Object
  extended by com.bigdata.counters.AbstractProcessReader
      extended by com.bigdata.counters.ProcessReaderHelper
          extended by com.bigdata.counters.linux.PIDStatCollector.PIDStatReader
All Implemented Interfaces:
Runnable
Enclosing class:
PIDStatCollector

protected class PIDStatCollector.PIDStatReader
extends ProcessReaderHelper

Reads pidstat output and extracts and updates counter values.

Sample pidstat output.

         Linux 2.6.22.14-72.fc6 (hostname)    03/16/2008
         
         06:35:15 AM       PID   %user %system    %CPU   CPU  Command
         06:35:15 AM       501    0.00    0.01    0.00     1  kjournald
         
         06:35:15 AM       PID  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
         06:35:15 AM       501      0.00      0.00       0      0   0.00  kjournald
         
         06:35:15 AM       PID   kB_rd/s   kB_wr/s kB_ccwr/s  Command
         06:35:15 AM       501      0.00      1.13      0.00  kjournald
         
         06:35:15 AM       PID   cswch/s nvcswch/s  Command
         06:35:15 AM       501      0.00      0.00  kjournald
 

Version:
$Id: PIDStatCollector.java 4290 2011-03-11 15:12:26Z thompsonbry $
Author:
Bryan Thompson

Field Summary
 
Fields inherited from class com.bigdata.counters.ProcessReaderHelper
r
 
Fields inherited from class com.bigdata.counters.AbstractProcessReader
is, log
 
Constructor Summary
PIDStatCollector.PIDStatReader()
           
 
Method Summary
protected  ActiveProcess getActiveProcess()
          Override to return the ActiveProcess.
protected  void readProcess()
          The input arrives as an initial banner and a sequence of data reporting events, each of which is three lines.
 
Methods inherited from class com.bigdata.counters.ProcessReaderHelper
readLine, run, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PIDStatCollector.PIDStatReader

public PIDStatCollector.PIDStatReader()
Method Detail

getActiveProcess

protected ActiveProcess getActiveProcess()
Description copied from class: ProcessReaderHelper
Override to return the ActiveProcess.

Specified by:
getActiveProcess in class ProcessReaderHelper

readProcess

protected void readProcess()
                    throws IOException,
                           InterruptedException
The input arrives as an initial banner and a sequence of data reporting events, each of which is three lines. The first line is blank. The second line gives the headers for the event. The third line gives the data for the event. The 2nd and 3rd lines carry a timestamp as the first value.

When you request more than one kind of reporting, the three line set simply repeats for each class of events that are to be reported. E.g., cpu and io. This code diagnoses the event types by examining the header line.

Specified by:
readProcess in class ProcessReaderHelper
Throws:
IOException
InterruptedException
TODO:
since we are examining header lines and since sysstat is ported to many languages, it is possible that this will not work when the host is using an English locale.


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.