public class TimerMeter extends Object implements Runnable
Modifier and Type | Field and Description |
---|---|
protected int |
currentUpperLoopSizeBound
not private because needed in
obtainMeasurementsUsingDirectInvocation |
int |
increased
Global variable used by the core algorithm.
|
protected int |
iterationIncreaseStepWidth
See class description.
|
protected long |
methodReturnAtMeasurementFinish
Protected because it must be set and read in subclasses' that override
the
obtainMeasurementsUsingDirectInvocation method |
protected long |
methodReturnAtMeasurementStart
protected because it must be set and read in subclasses' that override
the
obtainMeasurementsUsingDirectInvocation method |
protected int |
numberOfIterationIncreaseSteps
Actual maximum number of for loop iterations that are executed between
two
nanoTime invocations (cf. |
protected int |
numberOfMeasurements
See class description.
|
protected int |
numberOfProcessRepetitions
Number of times the entire process is repeated.
|
protected int |
numberOfWarmupTimerInvocations
See class description.
|
protected static long |
publicDummy
This dummy variable is used for warmup; it is intentionally global
because of JIT / dead code elimination prevention.
|
protected String |
timerMethodName
TODO document assumption: parameterless and no class/package name!
--> no parentheses: (){}[]<> and no "."s and ";" s
|
protected String |
warningOnNegativeDiff
Warning message displayed when the timer value difference of two
consecutive is negative.
|
Constructor and Description |
---|
TimerMeter(int warmupLoops,
int repeats,
int measurements,
int increaseWidth,
int increaseAfter,
int clusterThreshold) |
Modifier and Type | Method and Description |
---|---|
TimerCharacterisation |
computeTimerCharacterization(long[][] timerMeterMeasurements,
boolean logValues)
TODO engineer for performance: use one-dimensional array and work with offsets?
|
static void |
main(String[] args)
Test main method.
|
protected long[][] |
obtainMeasurementsUsingDirectInvocation()
THIS METHOD MUST BE OVERRIDDEN IN SUBCLASSES.
|
String |
printTimerCharacterization() |
void |
run() |
protected static long publicDummy
protected int currentUpperLoopSizeBound
obtainMeasurementsUsingDirectInvocation
public int increased
protected int iterationIncreaseStepWidth
protected long methodReturnAtMeasurementFinish
obtainMeasurementsUsingDirectInvocation
methodprotected long methodReturnAtMeasurementStart
obtainMeasurementsUsingDirectInvocation
methodprotected int numberOfIterationIncreaseSteps
nanoTime
invocations (cf. class description)protected int numberOfMeasurements
protected int numberOfProcessRepetitions
protected int numberOfWarmupTimerInvocations
protected String timerMethodName
protected final String warningOnNegativeDiff
public TimerMeter(int warmupLoops, int repeats, int measurements, int increaseWidth, int increaseAfter, int clusterThreshold)
public static void main(String[] args)
args
- Command line arguments, unused.public final TimerCharacterisation computeTimerCharacterization(long[][] timerMeterMeasurements, boolean logValues)
timerMeterMeasurements
- The measurement resultslogValues
- Whether to log values or notprotected long[][] obtainMeasurementsUsingDirectInvocation()
nanoTime
.
After "warming up" the timer method numberOfWarmupTimerInvocations
times, this
method measures the duration of a 'for' loop. The measurement is repeated
numberOfMeasurements
times for each loop iteration number from
0 to numberOfIterationIncreaseSteps
.List
of measurementspublic String printTimerCharacterization()