avrora.sim.util
Class Counter

java.lang.Object
  extended byavrora.sim.Simulator.Probe.Empty
      extended byavrora.sim.util.Counter
All Implemented Interfaces:
Simulator.Probe

public class Counter
extends Simulator.Probe.Empty

The Counter class is a utility for profiling programs. It simply increments an internal counter every time the probe fires. This very simple type of probe can be used for profiling counts of basic blocks, interrupt routines, particular methods, inner loops, or even to count the total number of instructions executed in the program.


Nested Class Summary
 
Nested classes inherited from class avrora.sim.Simulator.Probe
Simulator.Probe.Empty
 
Field Summary
 long count
          The count field stores the accumulation of all events received by this counter.
 
Constructor Summary
Counter()
           
 
Method Summary
 void fireBefore(State state, int pc)
          The fireBefore() method is called before the probed instruction executes.
 
Methods inherited from class avrora.sim.Simulator.Probe.Empty
fireAfter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

count

public long count
The count field stores the accumulation of all events received by this counter. This field is incremented once each time the fireBefore() method is invoked.

Constructor Detail

Counter

public Counter()
Method Detail

fireBefore

public void fireBefore(State state,
                       int pc)
The fireBefore() method is called before the probed instruction executes. In the implementation of the counter, it simply updates the internal counter.

Specified by:
fireBefore in interface Simulator.Probe
Overrides:
fireBefore in class Simulator.Probe.Empty
Parameters:
state - the state of the simulation
pc - the address at which this instruction resides