avrora.sim.util
Class MemoryCounter
java.lang.Object
avrora.sim.Simulator.Watch.Empty
avrora.sim.util.MemoryCounter
- All Implemented Interfaces:
- Simulator.Watch
- public class MemoryCounter
- extends Simulator.Watch.Empty
The MemoryCounter
is the simplest example of memory profiling functionality. When inserted as
a watch at a particular memory location, it will simply count the number of reads and writes to that memory
location. It is analagous to the Counter
probe which is used to count the execution frequency
of a particular instruction.
- See Also:
Simulator.Watch
,
Counter
Field Summary |
long |
rcount
The rcount field stores the number of reads encountered for this memory location. |
long |
wcount
The wcount field stores the number of writes encountered for this memory location. |
Method Summary |
void |
fireBeforeRead(State state,
int data_addr)
The fireBeforeRead() method is called before the data address is read by the program. |
void |
fireBeforeWrite(State state,
int data_addr,
byte value)
The fireBeforeWrite() method is called before the data address is written by the program.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
rcount
public long rcount
- The
rcount
field stores the number of reads encountered for this memory location.
wcount
public long wcount
- The
wcount
field stores the number of writes encountered for this memory location.
MemoryCounter
public MemoryCounter()
fireBeforeRead
public void fireBeforeRead(State state,
int data_addr)
- The
fireBeforeRead()
method is called before the data address is read by the program. In
the implementation of MemoryCounter
, it simply increments the count of reads by one.
- Specified by:
fireBeforeRead
in interface Simulator.Watch
- Overrides:
fireBeforeRead
in class Simulator.Watch.Empty
- Parameters:
state
- the state of the simulationdata_addr
- the address of the data being referenced
fireBeforeWrite
public void fireBeforeWrite(State state,
int data_addr,
byte value)
- The
fireBeforeWrite()
method is called before the data address is written by the program.
In the implementation of MemoryCounter
, it simply increments the count of writes by one.
- Specified by:
fireBeforeWrite
in interface Simulator.Watch
- Overrides:
fireBeforeWrite
in class Simulator.Watch.Empty
- Parameters:
state
- the state of the simulationdata_addr
- the address of the data being referencedvalue
- the value being written to the memory location