public final class CounterArrayManager extends InstrumentedEventCounterManager
NOTE: Much of this class was stolen from CounterArray.java, which is now gone.
Modifier and Type | Field and Description |
---|---|
(package private) static double[][] |
counterArrays |
(package private) static boolean |
DEBUG |
(package private) static int |
INCREMENT |
(package private) static int |
INITIAL_COUNT
Implementation
|
(package private) static int |
numCounterArrays |
Constructor and Description |
---|
CounterArrayManager() |
Modifier and Type | Method and Description |
---|---|
Instruction |
createEventCounterInstruction(int handle,
int index,
double incrementValue)
Create a place holder instruction to represent the counted event.
|
(package private) static void |
decay(int handle,
double rate)
decay counters
|
private static void |
expandCounterArrays()
increment the number of counter arrays
|
double |
getCounter(int handle,
int index) |
(package private) static RegisterOperand |
InsertALoadOffset(Instruction s,
IR ir,
Operator operator,
TypeReference type,
Operand reg2,
int offset)
Insert array load off before s in the instruction stream.
|
void |
insertBaselineCounter()
Still under construction.
|
void |
mutateOptEventCounterInstruction(Instruction counterInst,
IR ir)
Take an event counter instruction and mutate it into IR
instructions that will do the actual counting.
|
int |
registerCounterSpace(int countersNeeded)
This method is called by a
ManagedCounterData object to obtain space
in the counter manager. |
void |
resizeCounterSpace(int handle,
int countersNeeded)
This method is called to change the number of counters needed.
|
void |
setCounter(int handle,
int index,
double value)
Sets the value of a counter.
|
static final boolean DEBUG
static final int INITIAL_COUNT
static final int INCREMENT
static int numCounterArrays
static double[][] counterArrays
public CounterArrayManager()
public int registerCounterSpace(int countersNeeded)
ManagedCounterData
object to obtain space
in the counter manager. A handle or "ID" is returned for the
data to identify its counter space.registerCounterSpace
in class InstrumentedEventCounterManager
countersNeeded
- The number of counters being requestedpublic void resizeCounterSpace(int handle, int countersNeeded)
InstrumentedEventCounterManager
resizeCounterSpace
in class InstrumentedEventCounterManager
handle
- The handle describing which the data to be resizedcountersNeeded
- The number of counters neededpublic double getCounter(int handle, int index)
getCounter
in class InstrumentedEventCounterManager
handle
- The counter space to look inindex
- The counter whose value to returnpublic void setCounter(int handle, int index, double value)
InstrumentedEventCounterManager
setCounter
in class InstrumentedEventCounterManager
handle
- The counter space to look inindex
- The counter whose value to returnvalue
- The new value of the counterpublic Instruction createEventCounterInstruction(int handle, int index, double incrementValue)
createEventCounterInstruction
in class InstrumentedEventCounterManager
handle
- The handle of the array for the methodindex
- Index within that arrayincrementValue
- The value to add to the counterpublic void mutateOptEventCounterInstruction(Instruction counterInst, IR ir)
mutateOptEventCounterInstruction
in class InstrumentedEventCounterManager
counterInst
- The counter instruction to mutateir
- The governing IRstatic RegisterOperand InsertALoadOffset(Instruction s, IR ir, Operator operator, TypeReference type, Operand reg2, int offset)
s
- the instruction to insert beforeir
- the containing IRoperator
- the operator to inserttype
- the type of the resultreg2
- the base to load fromoffset
- the offset to load atpublic void insertBaselineCounter()
insertBaselineCounter
in class InstrumentedEventCounterManager
static void decay(int handle, double rate)
handle
- The identifier of the counter array to decayrate
- The rate at which to decay, i.e. a value of 2 will divide
all values in halfprivate static void expandCounterArrays()