|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectavrora.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| 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(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 |
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 fireBefore(Instr i,
int address,
State state)
fireBefore() method is called before the probed instruction executes. In the
implementation of the branch counter, nothing needs to be done before the branch is executed, so this
method does nothing.
fireBefore in interface Simulator.Probei - the instruction being probedaddress - the address at which this instruction residesstate - the state of the simulation
public void fireAfter(Instr i,
int address,
State state)
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.Probei - the instruction being probedaddress - the address at which this instruction residesstate - the state of the simulation
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||