|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.sim.Simulator.Probe.Empty avrora.sim.util.BranchCounter
The BranchCounter
class is a profiling probe that can be inserted at a branch instruction to
count the number of times the branch is taken and not taken. It demonstrates the ability to inspect the
state of the program after the execution of a program. It determines whether the branch was taken by
inspecting the program counter of the new state. If the program counter is not equal to the instruction
following the branch, then the branch was taken.
Counter
Nested Class Summary |
Nested classes inherited from class avrora.sim.Simulator.Probe |
Simulator.Probe.Empty |
Field Summary | |
int |
nottakenCount
This field tracks the number of times the branch is not taken. |
int |
takenCount
This field tracks the number of times the branch is taken. |
Constructor Summary | |
BranchCounter()
|
Method Summary | |
void |
fireAfter(State state,
int pc)
The fireAfter() method is called after the probed instruction executes. |
Methods inherited from class avrora.sim.Simulator.Probe.Empty |
fireBefore |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public int takenCount
fireAfter
method if the branch was taken.
public int nottakenCount
fireAfter
method if the branch was not taken.
Constructor Detail |
public BranchCounter()
Method Detail |
public void fireAfter(State state, int pc)
fireAfter()
method is called after the probed instruction executes. In the
implementation of the branch counter, the counter determines whether the branch was taken by inspecting
the program counter of the new state. If the program counter is not equal to the instruction following
the branch, then the branch was taken.
fireAfter
in interface Simulator.Probe
fireAfter
in class Simulator.Probe.Empty
state
- the state of the simulationpc
- the address at which this instruction resides
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |