|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectavrora.sim.util.MemoryMatrixProfiler
The MemoryMatrixProfiler class collects information about
a program's usage of memory. For each instruction in the program, it
tracks the memory locations read and written by that instruction. For
example, a load instruction that uses an address in a register might
load bytes from various locations in the data memory. This class
maintains two internal two-dimensional matrices, one for read counts
and one for write counts. The matrices are indexed by code address
and data address.
| Field Summary | |
int |
ramSize
The ramSize field stores the maximum RAM address that should
be recorded. |
long[][] |
rcount
The rcount field stores a two dimensional array that records
the read count for each memory location for each instruction. |
long[][] |
wcount
The rcount field stores a two dimensional array that records
the write count for each memory location for each instruction. |
| Constructor Summary | |
MemoryMatrixProfiler(Program p,
int size)
The constructor for the MemoryMatrixProfiler class creates
a new memory probe that can be inserted into the simulator to record the
full memory access statistics of the program. |
|
| Method Summary | |
void |
fireAfterRead(Instr i,
int address,
State state,
int data_addr,
byte value)
The fireAfterRead() method is called after the data address
is read by the program. |
void |
fireAfterWrite(Instr i,
int address,
State state,
int data_addr,
byte value)
The fireAfterWrite() method is called after the data address
is written by the program. |
void |
fireBeforeRead(Instr i,
int address,
State state,
int data_addr,
byte value)
The fireBeforeRead() method is called before the data address
is read by the program. |
void |
fireBeforeWrite(Instr i,
int address,
State state,
int data_addr,
byte value)
The fireBeforeWrite() method is called before the data address
is written by the program. |
long |
getReadCount(int address,
int data_addr)
The getReadCount() method returns the number of times the specified
instruction read the specified memory address. |
long |
getWriteCount(int address,
int data_addr)
The getWriteCount() method returns the number of times the specified
instruction wrote the specified memory address. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public final long[][] rcount
rcount field stores a two dimensional array that records
the read count for each memory location for each instruction. It is indexed by
program address, and then by data address. This matrix is row-sparse in
that rows of all zero (e.g. a non-memory instruction) are not stored.
To access this matrix, use the getReadCount() method.
public final long[][] wcount
rcount field stores a two dimensional array that records
the write count for each memory location for each instruction. It is indexed by
program address, and then by data address. This matrix is row-sparse in
that rows of all zero (e.g. a non-memory instruction) are not stored.
To access this matrix, use the getWriteCount() method.
public final int ramSize
ramSize field stores the maximum RAM address that should
be recorded.
| Constructor Detail |
public MemoryMatrixProfiler(Program p,
int size)
MemoryMatrixProfiler class creates
a new memory probe that can be inserted into the simulator to record the
full memory access statistics of the program.
p - the program to record statistics forsize - the size of the RAM in bytes| Method Detail |
public void fireBeforeRead(Instr i,
int address,
State state,
int data_addr,
byte value)
fireBeforeRead() method is called before the data address
is read by the program. In the implementation of MemoryMatrixProfiler,
it simply increments the count of reads at the address of the instruction and
memory location by one.
i - the instruction being probedaddress - the address at which this instruction residesstate - the state of the simulationdata_addr - the address of the data being referencedvalue - the value of the memory location being read
public void fireBeforeWrite(Instr i,
int address,
State state,
int data_addr,
byte value)
fireBeforeWrite() method is called before the data address
is written by the program. In the implementation of MemoryMatrixProfiler,
it simply increments the count of writes at the address of the instruction and
memory location by one.
i - the instruction being probedaddress - the address at which this instruction residesstate - the state of the simulationdata_addr - the address of the data being referencedvalue - the value being written to the memory location
public void fireAfterRead(Instr i,
int address,
State state,
int data_addr,
byte value)
fireAfterRead() method is called after the data address
is read by the program. In the implementation of MemoryMatrixProfiler,
it does nothing.
i - the instruction being probedaddress - the address at which this instruction residesstate - the state of the simulationdata_addr - the address of the data being referencedvalue - the value of the memory location being read
public void fireAfterWrite(Instr i,
int address,
State state,
int data_addr,
byte value)
fireAfterWrite() method is called after the data address
is written by the program. In the implementation of MemoryMatrixProfiler,
it does nothing.
i - the instruction being probedaddress - the address at which this instruction residesstate - the state of the simulationdata_addr - the address of the data being referencedvalue - the value being written to the memory location
public long getReadCount(int address,
int data_addr)
getReadCount() method returns the number of times the specified
instruction read the specified memory address.
address - the program address of the instructiondata_addr - the address of the byte of memory
public long getWriteCount(int address,
int data_addr)
getWriteCount() method returns the number of times the specified
instruction wrote the specified memory address.
address - the program address of the instructiondata_addr - the address of the byte of memory
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||