avrora.monitors
Class MonitorFactory

java.lang.Object
  extended byavrora.monitors.MonitorFactory
Direct Known Subclasses:
MemoryMonitor, ProfileMonitor, SleepMonitor, StackMonitor

public abstract class MonitorFactory
extends java.lang.Object

The MonitorFactory class represents a profiling utility that is able to produce a Monitor for a simulation. The monitor can use probes, watches, and events to monitor the execution of the program and issue a report after the simulation is completed.


Field Summary
 java.lang.String help
          The help field stores a reference to a string that represents the contextual help from this monitor.
 Options options
          The options field stores a reference to an instance of the Options class that stores the command line options to the monitor.
 java.lang.String shortName
          The shortName field stores a reference to the short name of the monitor.
 
Constructor Summary
protected MonitorFactory(java.lang.String sn, java.lang.String h)
          The constructor for the MonitorFactory class initializes the options field, as well as the references to the help string and the short name of the monitor.
 
Method Summary
 java.lang.String getShortName()
          The getShortName() method returns a shortened version of the name of this monitor for more quick access at the command line.
abstract  Monitor newMonitor(Simulator s)
          The newMonitor() method creates a new monitor for the specified instance of Simulator.
 void processOptions(Options o)
          The processOptions() method is called after the MonitorFactory instance is created.
protected  void reportQuantity(java.lang.String name, float val, java.lang.String units)
          The reportQuantity() method can be used by subclasses of MonitorFactory to report various quantities such as execution time, cycles spent sleeping, etc, to the terminal.
protected  void reportQuantity(java.lang.String name, long val, java.lang.String units)
          The reportQuantity() method can be used by subclasses of MonitorFactory to report various quantities such as execution time, cycles spent sleeping, etc, to the terminal.
protected  void reportQuantity(java.lang.String name, java.lang.String val, java.lang.String units)
          The reportQuantity() method can be used by subclasses of MonitorFactory to report various quantities such as execution time, cycles spent sleeping, etc, to the terminal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

help

public final java.lang.String help
The help field stores a reference to a string that represents the contextual help from this monitor.


shortName

public final java.lang.String shortName
The shortName field stores a reference to the short name of the monitor.


options

public final Options options
The options field stores a reference to an instance of the Options class that stores the command line options to the monitor.

Constructor Detail

MonitorFactory

protected MonitorFactory(java.lang.String sn,
                         java.lang.String h)
The constructor for the MonitorFactory class initializes the options field, as well as the references to the help string and the short name of the monitor.

Parameters:
sn - the short name of the monitor as a string
h - the help item for the monitor as a string
Method Detail

newMonitor

public abstract Monitor newMonitor(Simulator s)
The newMonitor() method creates a new monitor for the specified instance of Simulator. The resulting monitor may insert probes, watches, or events into the simulation to collect information and later report that information after the simulation is complete.

Parameters:
s - the Simulator instance to create the monitor for
Returns:
an instance of the Monitor interface that represents the monitor for the simulator

processOptions

public void processOptions(Options o)
The processOptions() method is called after the MonitorFactory instance is created. These options are the options left over from processing the command line, extracting the parameters to the main program, extracting the parameters from the action.

Parameters:
o - the options representing the known and unknown options from the command line

getShortName

public java.lang.String getShortName()
The getShortName() method returns a shortened version of the name of this monitor for more quick access at the command line.

Returns:
a string representation of an abbreviated name for this monitor

reportQuantity

protected void reportQuantity(java.lang.String name,
                              long val,
                              java.lang.String units)
The reportQuantity() method can be used by subclasses of MonitorFactory to report various quantities such as execution time, cycles spent sleeping, etc, to the terminal.

Parameters:
name - the name of the quantity being reported
val - the value to be reported as a long integer
units - the units for the quantity as a string

reportQuantity

protected void reportQuantity(java.lang.String name,
                              float val,
                              java.lang.String units)
The reportQuantity() method can be used by subclasses of MonitorFactory to report various quantities such as execution time, cycles spent sleeping, etc, to the terminal.

Parameters:
name - the name of the quantity being reported
val - the value to be reported as a floating point number
units - the units for the quantity as a string

reportQuantity

protected void reportQuantity(java.lang.String name,
                              java.lang.String val,
                              java.lang.String units)
The reportQuantity() method can be used by subclasses of MonitorFactory to report various quantities such as execution time, cycles spent sleeping, etc, to the terminal.

Parameters:
name - the name of the quantity being reported
val - the value to be reported as a string
units - the units for the quantity as a string