org.jrabbit.standard.profiler.entities.standard
Class SystemInfo

java.lang.Object
  extended by org.jrabbit.standard.profiler.entities.base.BaseProfilerEntity
      extended by org.jrabbit.standard.profiler.entities.base.FontBasedProfilerEntity
          extended by org.jrabbit.standard.profiler.entities.base.TextProfilerEntity
              extended by org.jrabbit.standard.profiler.entities.standard.SystemInfo
All Implemented Interfaces:
Renderable, Updateable, Referenced, Dimensioned, Visible, ProfilerEntity

public class SystemInfo
extends TextProfilerEntity
implements Updateable

SystemInfo displays some basic information about the JVM and computer running the machine. Its most immediately useful bit of information is that it shows how much memory the JVM is currently using.

Author:
Chris Molini

Field Summary
static int BYTES
          The format to show memory information in Bytes.
protected  int counter
          This variable keeps track of updating the SystemInfo.
protected  int format
          The format the SystemInfo is using.
protected  int interval
          This variable marks how long the SystemInfo should wait before recalculating the memory usage.
static int KILOBYTES
          The format to show memory information in Kilobytes.
static int MEGABYTES
          The format to show memory information in Megabytes.
static int PERCENT
          The format to show memory information as a percent of system total.
 
Fields inherited from class org.jrabbit.standard.profiler.entities.base.TextProfilerEntity
text, widths
 
Fields inherited from class org.jrabbit.standard.profiler.entities.base.FontBasedProfilerEntity
fontPointer
 
Fields inherited from class org.jrabbit.standard.profiler.entities.base.BaseProfilerEntity
height, reference, visible, width
 
Constructor Summary
SystemInfo()
          Creates a SystemInfo that shows memory information in megabytes and updates its memory display three times a second.
SystemInfo(int format, int interval)
          Creates a SystemInfo that uses the indicated format and interval.
 
Method Summary
 int format()
          Learns the current format of the SystemInfo.
protected static java.lang.String getMemUsage(int format)
          Calculates the String that represents memory usage.
 int interval()
          Learns the current interval between updates.
 void recalculate()
          Recalculates memory information.
 void setFormat(int format)
          Redefines the format the SystemInfo uses.
 void setInterval(int interval)
          Redefines the duration between each update.
 void update(int delta)
          Updates the SystemInfo, determining if it needs to
 
Methods inherited from class org.jrabbit.standard.profiler.entities.base.TextProfilerEntity
getText, render, setText, setText, updateDimensions
 
Methods inherited from class org.jrabbit.standard.profiler.entities.base.FontBasedProfilerEntity
fontPointer
 
Methods inherited from class org.jrabbit.standard.profiler.entities.base.BaseProfilerEntity
height, reference, setVisible, visible, width
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BYTES

public static final int BYTES
The format to show memory information in Bytes.

See Also:
Constant Field Values

KILOBYTES

public static final int KILOBYTES
The format to show memory information in Kilobytes.

See Also:
Constant Field Values

MEGABYTES

public static final int MEGABYTES
The format to show memory information in Megabytes.

See Also:
Constant Field Values

PERCENT

public static final int PERCENT
The format to show memory information as a percent of system total.

See Also:
Constant Field Values

format

protected int format
The format the SystemInfo is using.


counter

protected int counter
This variable keeps track of updating the SystemInfo.


interval

protected int interval
This variable marks how long the SystemInfo should wait before recalculating the memory usage.

Constructor Detail

SystemInfo

public SystemInfo()
Creates a SystemInfo that shows memory information in megabytes and updates its memory display three times a second.


SystemInfo

public SystemInfo(int format,
                  int interval)
Creates a SystemInfo that uses the indicated format and interval.

Parameters:
format - The format the SystemInfo should use to display memory info.
interval - The duration between each update.
Method Detail

getMemUsage

protected static java.lang.String getMemUsage(int format)
Calculates the String that represents memory usage.

Parameters:
format - The format in which to retrieve the info.
Returns:
A String describing current memory usage.

format

public int format()
Learns the current format of the SystemInfo.

Returns:
The integer that indicates which format the SystemInfo should use.
See Also:
BYTES, KILOBYTES, MEGABYTES, PERCENT

setFormat

public void setFormat(int format)
Redefines the format the SystemInfo uses.

Parameters:
format - The new format to use.
See Also:
BYTES, KILOBYTES, MEGABYTES, PERCENT

interval

public int interval()
Learns the current interval between updates.

Returns:
The number of clock ticks the SystemInfo waits to update itself.

setInterval

public void setInterval(int interval)
Redefines the duration between each update.

Parameters:
interval - The number of clock ticks the SystemInfo should wait between each update of its displayed information.

recalculate

public void recalculate()
Recalculates memory information.


update

public void update(int delta)
Updates the SystemInfo, determining if it needs to

Specified by:
update in interface Updateable
Parameters:
delta - The time passed since the last update. The default units are in microseconds.