platform
Class VMPerfDataFile

java.lang.Object
  extended by platform.VMPerfDataFile

public final class VMPerfDataFile
extends java.lang.Object

Util class to retrieve various details about running virtual machines.

Author:
Christian Banse

Field Summary
private  java.lang.Object m_buff
          The buffer used to read from the data file.
private  boolean m_bUsable
          This class will only be usable on some java runtimes
private static java.lang.reflect.Method m_byteBufferGetIntMethod
          ByteBuffer.getInt()
private static java.lang.reflect.Method m_byteBufferGetMethod
          ByteBuffer.get()
private static java.lang.reflect.Method m_byteBufferPositionMethod
          ByteBuffer.position(int)
private static java.lang.Class m_javaNioByteBufferClass
          java.nio.ByteBuffer
private static java.lang.Class m_javaNioByteOrderClass
          java.nio.ByteOrder
private  int m_nextEntry
          Position of the next data entry in the byte buffer
private  int m_numEntries
          Data entry count
private  java.lang.Object m_perf
          The underlaying perfomance data object Original type: sun.misc.Perf
private static java.lang.Class m_sunMiscPerfClass
          sun.misc.Perf
private  java.util.Hashtable m_tblEntries
          The performance data entries
private  int m_vmId
          The id of the virtual machine
private static java.lang.Integer PERFDATA_ACCESSIBLE_POSITION
          Position of the accessible byte
private static java.lang.Integer PERFDATA_BYTEORDER_POSITION
          Position of the byte order
private static java.lang.Integer PERFDATA_ENTRYOFFSET_POSITION
          Position of the data entries
private static int PERFDATA_MAGIC
          The magic integer
private static java.lang.Integer PERFDATA_MAGIC_POSITION
          Position of the magic integer
private static java.lang.Integer PERFDATA_NUMENTRIES_POSITION
          Position of the data entry count
private static int PERFDATA_SYNC_TIMEOUT
          Virtual machine sync timeout
 
Constructor Summary
VMPerfDataFile(int a_vmId)
          Creates a new VMPerfDataFile with the specified id.
 
Method Summary
private  boolean buildEntries()
          Builds all data entries from the byte buffer
private  boolean buildNextEntry()
          Builds the next data entry
private  java.lang.Object getByteOrder()
          Returns the byte order of the underlaying perfomance file Original return type: java.nio.ByteOrder
 int getId()
          Returns the id of the Virtual Machine
private  int getMagic()
          Gets the magic integer of the VM datafile
 java.lang.String getMainClass()
          Returns the main class of the Virtual Machine
private  boolean isAccessible()
          Checks if the VM perf data file is accessible
 boolean isUsable()
          Checks if the Class is usable with the current VM
 java.lang.String toString()
          toString() helper class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_tblEntries

private java.util.Hashtable m_tblEntries
The performance data entries


m_buff

private java.lang.Object m_buff
The buffer used to read from the data file. Original type: java.nio.ByteBuffer


m_perf

private java.lang.Object m_perf
The underlaying perfomance data object Original type: sun.misc.Perf


m_bUsable

private boolean m_bUsable
This class will only be usable on some java runtimes


m_nextEntry

private int m_nextEntry
Position of the next data entry in the byte buffer


m_numEntries

private int m_numEntries
Data entry count


PERFDATA_MAGIC_POSITION

private static final java.lang.Integer PERFDATA_MAGIC_POSITION
Position of the magic integer


PERFDATA_BYTEORDER_POSITION

private static final java.lang.Integer PERFDATA_BYTEORDER_POSITION
Position of the byte order


PERFDATA_ACCESSIBLE_POSITION

private static final java.lang.Integer PERFDATA_ACCESSIBLE_POSITION
Position of the accessible byte


PERFDATA_ENTRYOFFSET_POSITION

private static final java.lang.Integer PERFDATA_ENTRYOFFSET_POSITION
Position of the data entries


PERFDATA_NUMENTRIES_POSITION

private static final java.lang.Integer PERFDATA_NUMENTRIES_POSITION
Position of the data entry count


PERFDATA_MAGIC

private static final int PERFDATA_MAGIC
The magic integer

See Also:
Constant Field Values

PERFDATA_SYNC_TIMEOUT

private static final int PERFDATA_SYNC_TIMEOUT
Virtual machine sync timeout

See Also:
Constant Field Values

m_javaNioByteBufferClass

private static java.lang.Class m_javaNioByteBufferClass
java.nio.ByteBuffer


m_javaNioByteOrderClass

private static java.lang.Class m_javaNioByteOrderClass
java.nio.ByteOrder


m_sunMiscPerfClass

private static java.lang.Class m_sunMiscPerfClass
sun.misc.Perf


m_byteBufferPositionMethod

private static java.lang.reflect.Method m_byteBufferPositionMethod
ByteBuffer.position(int)


m_byteBufferGetMethod

private static java.lang.reflect.Method m_byteBufferGetMethod
ByteBuffer.get()


m_byteBufferGetIntMethod

private static java.lang.reflect.Method m_byteBufferGetIntMethod
ByteBuffer.getInt()


m_vmId

private int m_vmId
The id of the virtual machine

Constructor Detail

VMPerfDataFile

public VMPerfDataFile(int a_vmId)
Creates a new VMPerfDataFile with the specified id.

Parameters:
a_vmId - Id of the Virtual Machine
Method Detail

buildEntries

private boolean buildEntries()
                      throws java.lang.Exception
Builds all data entries from the byte buffer

Returns:
true if the build was successful, false otherwise
Throws:
java.lang.Exception

buildNextEntry

private boolean buildNextEntry()
                        throws java.lang.Exception
Builds the next data entry

Returns:
true if the build was succesful, false otherwise
Throws:
java.lang.Exception

isAccessible

private boolean isAccessible()
                      throws java.lang.Exception
Checks if the VM perf data file is accessible

Returns:
true if the VM is accessible, false otherwise
Throws:
java.lang.Exception

getMagic

private int getMagic()
              throws java.lang.Exception
Gets the magic integer of the VM datafile

Returns:
the magic integer
Throws:
java.lang.Exception

getByteOrder

private java.lang.Object getByteOrder()
                               throws java.lang.Exception
Returns the byte order of the underlaying perfomance file Original return type: java.nio.ByteOrder

Returns:
the byte order
Throws:
java.lang.Exception

getMainClass

public java.lang.String getMainClass()
Returns the main class of the Virtual Machine

Returns:
the main class as String

getId

public int getId()
Returns the id of the Virtual Machine

Returns:
the id

toString

public java.lang.String toString()
toString() helper class

Overrides:
toString in class java.lang.Object
Returns:
the main class

isUsable

public boolean isUsable()
Checks if the Class is usable with the current VM

Returns:
true if the Class is usable, false otherwise