avrora.sim.util
Class RangeProfiler

java.lang.Object
  extended byavrora.sim.util.RangeProfiler

public class RangeProfiler
extends java.lang.Object

The RangeProfiler class implements a probe that can be used to profile a range of addresses in the program. It maintains a simple array of long that stores the count for each instruction in the specified range. It is more space efficient than the ProgramProfiler since it only stores the count for the range specified instead of for the entire program.

See Also:
Counter, ProgramProfiler

Field Summary
 int high_addr
          The high_addr stores the highest address in the range.
 long[] icount
          The itime field stores the invocation count for each instruction in the range.
 int low_addr
          The low_addr stores the lowest address in the range.
 Program program
          The program field stores a reference to the program being profiled.
 
Constructor Summary
RangeProfiler(Program p, int low, int high)
          The constructor for the program profiler constructs the required internal state to store the invocation counts of each instruction.
 
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

program

public final Program program
The program field stores a reference to the program being profiled.


low_addr

public final int low_addr
The low_addr stores the lowest address in the range.


high_addr

public final int high_addr
The high_addr stores the highest address in the range.


icount

public final long[] icount
The itime field stores the invocation count for each instruction in the range. It is indexed by byte addresses, with expr 0 corresponding to the lowest address in the range (low_addr). at program.getInstr(addr).

Constructor Detail

RangeProfiler

public RangeProfiler(Program p,
                     int low,
                     int high)
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
low - the low address in the range
high - the high address in the range
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 range profiler, it simply increments the count of the instruction at the specified address if that address is in the given range.

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 range profiler, it does nothing.

Parameters:
i - the instruction being probed
address - the address at which this instruction resides
state - the state of the simulation