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 ProgramProfiler

    java.lang.Object
      avrora.sim.Simulator.Probe.Empty
          avrora.sim.util.ProgramProfiler

All Implemented Interfaces:
  Simulator.Probe

public class ProgramProfiler
extends Simulator.Probe.Empty

The `ProgramProfiler` class implements a probe that can be used to profile pieces of the program or the whole program. It maintains a simple array of `long` that stores the count for every instruction.

See Also:
  `Counter`

Nested Class Summary

Nested classes inherited from class avrora.sim.Simulator.Probe
`Simulator.Probe.Empty`

Field Summary
`long[]` | `icount` The `itime` field stores the invocation count for each instruction in the program.
`Program` | `program` The `program` field stores a reference to the program being profiled.

Constructor Summary
`ProgramProfiler(Program p)` The constructor for the program profiler constructs the required internal state to store the invocation counts of each instruction.

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

### program

    public final Program program

  The `program` field stores a reference to the program being profiled.

### icount

    public final long[] icount

  The `itime` field stores the invocation count for each instruction in the program. It is indexed by byte addresses. Thus `itime[addr]` corresponds to the invocation for the instruction at `program.getInstr(addr)`.

Constructor Detail

### ProgramProfiler

    public ProgramProfiler(Program p)

  The constructor for the program profiler constructs the required internal state to store the invocation counts of each instruction.

Parameters:
  `p` - the program to profile

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 program profiler, it simply increments the count of the instruction at the specified address.

  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

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