org.ow2.clif.probe.memory.linux
Class GenericProbe

java.lang.Object
  extended by org.ow2.clif.probe.memory.linux.GenericProbe

public class GenericProbe
extends java.lang.Object

Linux generic memory probe intended to be more impervious to /proc file format changes. Reads data from /proc/meminfo, supposed to be formatted as a list of "attribute: value [unit]" lines.

Author:
Bruno Dillenseger

Constructor Summary
GenericProbe(java.lang.String[] fields)
          Creates a new memory probe that will return only the mentioned attributes' values, in the very same order.
 
Method Summary
 long[] getData()
          Reads the system data source file for memory usage, and returns the values of attributes of interest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericProbe

public GenericProbe(java.lang.String[] fields)
             throws java.lang.Exception
Creates a new memory probe that will return only the mentioned attributes' values, in the very same order.

Parameters:
fields - names of attributes of interest.
Throws:
java.lang.Exception - an attribute name does not exist
See Also:
getData()
Method Detail

getData

public long[] getData()
               throws java.io.IOException
Reads the system data source file for memory usage, and returns the values of attributes of interest.

Returns:
values of memory attributes of interest, as specified at probe creation (in the same order).
Throws:
java.io.IOException - for some reason, the system data source file could not be read, or more probably the file format is not compatible with this probe.
See Also:
GenericProbe(String[])