org.mmtk.utility.statistics
Class EventCounter

java.lang.Object
  extended by org.mmtk.utility.statistics.Counter
      extended by org.mmtk.utility.statistics.EventCounter

public class EventCounter
extends Counter

This class implements a simple event counter (counting number events that occur for each phase).


Field Summary
private  long[] count
           
protected  long currentCount
           
private  boolean running
           
 
Fields inherited from class org.mmtk.utility.statistics.Counter
complex
 
Constructor Summary
EventCounter(String name)
          Constructor
EventCounter(String name, boolean start)
          Constructor
EventCounter(String name, boolean start, boolean mergephases)
          Constructor
 
Method Summary
 void inc()
          Increment the event counter
 void inc(int value)
          Increment the event counter by value
(package private)  void phaseChange(int oldPhase)
          The phase has changed (from GC to mutator or mutator to GC).
protected  void printCount(int phase)
          Print the value of this counter for the given phase
 void printCurrent()
          Print the current value for this counter (mid-phase)
 void printLast()
          Print statistics for the most recent phase
protected  void printMax(boolean mutator)
          Print the current maximum value for either the mutator or GC phase
protected  void printMin(boolean mutator)
          Print the current minimum value for either the mutator or GC phase
 void printTotal()
          Print the current total for this counter
protected  void printTotal(boolean mutator)
          Print the current total for either the mutator or GC phase
(package private)  void printValue(long value)
          Print the given value
protected  void start()
          Start this counter
protected  void stop()
          Stop this counter
 
Methods inherited from class org.mmtk.utility.statistics.Counter
getColumnSuffix, getName, getStart, isComplex, mergePhases
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

count

private final long[] count

currentCount

protected long currentCount

running

private boolean running
Constructor Detail

EventCounter

public EventCounter(String name)
Constructor

Parameters:
name - The name to be associated with this counter

EventCounter

public EventCounter(String name,
                    boolean start)
Constructor

Parameters:
name - The name to be associated with this counter
start - True if this counter is to be implicitly started when startAll() is called (otherwise the counter must be explicitly started).

EventCounter

public EventCounter(String name,
                    boolean start,
                    boolean mergephases)
Constructor

Parameters:
name - The name to be associated with this counter
start - true if this counter is to be implicitly started when startAll() is called (otherwise the counter must be explicitly started).
mergephases - true if this counter does not separately report GC and Mutator phases.
Method Detail

inc

public void inc()
Increment the event counter


inc

public void inc(int value)
Increment the event counter by value

Parameters:
value - The amount by which the counter should be incremented.

start

protected void start()
Start this counter

Specified by:
start in class Counter

stop

protected void stop()
Description copied from class: Counter
Stop this counter

Specified by:
stop in class Counter

phaseChange

void phaseChange(int oldPhase)
The phase has changed (from GC to mutator or mutator to GC). Take action with respect to the last phase if necessary. Do nothing in this case.

Specified by:
phaseChange in class Counter
Parameters:
oldPhase - The last phase

printCount

protected final void printCount(int phase)
Print the value of this counter for the given phase Print '0' for false, '1' for true.

Specified by:
printCount in class Counter
Parameters:
phase - The phase to be printed

printCurrent

public final void printCurrent()
Print the current value for this counter (mid-phase)


printTotal

public final void printTotal()
Description copied from class: Counter
Print the current total for this counter

Specified by:
printTotal in class Counter

printTotal

protected final void printTotal(boolean mutator)
Description copied from class: Counter
Print the current total for either the mutator or GC phase

Specified by:
printTotal in class Counter
Parameters:
mutator - true if the total for the mutator phases is to be printed (otherwise the total for the GC phases will be printed).

printMin

protected final void printMin(boolean mutator)
Description copied from class: Counter
Print the current minimum value for either the mutator or GC phase

Specified by:
printMin in class Counter
Parameters:
mutator - true if the minimum for the mutator phase is to be printed (otherwise the minimum for the GC phase will be printed).

printMax

protected final void printMax(boolean mutator)
Description copied from class: Counter
Print the current maximum value for either the mutator or GC phase

Specified by:
printMax in class Counter
Parameters:
mutator - true if the maximum for the mutator phase is to be printed (otherwise the maximum for the GC phase will be printed).

printValue

void printValue(long value)
Print the given value

Parameters:
value - The value to be printed

printLast

public void printLast()
Description copied from class: Counter
Print statistics for the most recent phase

Overrides:
printLast in class Counter