Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.sim.util
Class Counter

    java.lang.Object
      avrora.sim.util.Counter

All Implemented Interfaces:
  Simulator.Probe

public class Counter
extends java.lang.Object
implements Simulator.Probe

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.

Field Summary
`long` | `count` The `count` field stores the accumulation of all events received by this counter.

Constructor Summary
`Counter()`

Method Summary
`void` | `fireAfter(Instr i, int address, State state)` The `fireAfter()` method is called after the probed instruction executes.
`void` | `fireBefore(Instr i, int address, State state)` The `fireBefore()` method is called before the probed instruction executes.

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(Instr i,
                           int address,
                           State state)

  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`
  Parameters:
    `i` - the instruction being probed
    `address` - the address at which this instruction resides
    `state` - the state of the simulation

### fireAfter

    public void fireAfter(Instr i,
                          int address,
                          State state)

  The `fireAfter()` method is called after the probed instruction executes. In the implementation of the counter, it does nothing.

  Specified by:
    `fireAfter` in interface `Simulator.Probe`
  Parameters:
    `i` - the instruction being probed
    `address` - the address at which this instruction resides
    `state` - the state of the simulation

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD