|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbb.util.Benchmark.Params
public static class Benchmark.Params
Holds parameters which specify how the benchmarking is carried out.
Field Summary | |
---|---|
protected double |
cleanFractionThreshold
Maximum fraction of time that can be spent doing a final JVM cleanup after all measurements have been performed before a warning is issued that the measurements may be too small (because they failed to include cleanup costs). |
protected double |
confidenceLevel
If manyExecutions is true ,
then specifies the confidence level to use when calculating the confidence intervals for the statistics. |
protected boolean |
consoleFeedback
Specifies whether or not console feedback should be given regarding the benchmarking progress. |
protected boolean |
estimateNoiseFloor
Specifies whether or not Benchmark.noiseTask will be run. |
protected double |
executionTimeGoal
If manyExecutions is true ,
then is used to determine how many executions of Benchmark.task to perform for each timing. |
protected boolean |
manyExecutions
Specifies whether or not many executions of Benchmark.task should be performed (as opposed to executing it just once). |
protected boolean |
measureCpuTime
Specifies whether or not the execution time is measured as CPU time or elapsed ("wall clock") time. |
protected long |
numberActions
Records how many actions are performed by each invocation of Benchmark.task . |
protected int |
numberMeasurements
If manyExecutions is true ,
then once Benchmark.numberExecutions has been determined, specifies the number of timing measurements to perform. |
protected double |
sdFractionThreshold
Maximum fraction of the standard deviation (sd) present in Benchmark.statsBlock
which may be due to effects besides Benchmark.task 's intrinsic variation
before a warning is issued that the sd is too high. |
protected double |
warmupTime
If manyExecutions is true,
then specifies the minimum amount of time that should execute Benchmark.task for before start recording measurements. |
Constructor Summary | |
---|---|
Benchmark.Params()
Creates a new instance with all fields left at their default initializations. |
|
Benchmark.Params(boolean manyExecutions)
Simply assigns manyExecutions to the corresponding field. |
|
Benchmark.Params(boolean manyExecutions,
long numberActions)
Simply assigns all the parameters to their corresponding fields. |
|
Benchmark.Params(long numberActions)
Simply assigns numberActions to the corresponding field. |
Method Summary | |
---|---|
Object |
clone()
Contract: returns a new Params instance that contains equivalent data to this instance. |
boolean |
equals(Object obj)
Determines equality based on whether or not obj 's Class
is the same as this instance's Class ,
and every field of it equals that of this instance. |
double |
getCleanFractionThreshold()
Accessor for cleanFractionThreshold . |
double |
getConfidenceLevel()
Accessor for confidenceLevel . |
boolean |
getConsoleFeedback()
Accessor for consoleFeedback . |
boolean |
getEstimateNoiseFloor()
Accessor for estimateNoiseFloor . |
double |
getExecutionTimeGoal()
Accessor for executionTimeGoal . |
boolean |
getManyExecutions()
Accessor for manyExecutions . |
boolean |
getMeasureCpuTime()
Accessor for measureCpuTime . |
long |
getNumberActions()
Accessor for numberActions . |
int |
getNumberMeasurements()
Accessor for numberMeasurements . |
double |
getSdFractionThreshold()
Accessor for sdFractionThreshold . |
double |
getWarmupTime()
Accessor for warmupTime . |
int |
hashCode()
Returns a value based on all of the non- boolean fields. |
void |
setCleanFractionThreshold(double cleanFractionThreshold)
Mutator for cleanFractionThreshold . |
void |
setConfidenceLevel(double confidenceLevel)
Mutator for confidenceLevel . |
void |
setConsoleFeedback(boolean consoleFeedback)
Mutator for consoleFeedback . |
void |
setEstimateNoiseFloor(boolean estimateNoiseFloor)
Mutator for estimateNoiseFloor . |
void |
setExecutionTimeGoal(double executionTimeGoal)
Mutator for executionTimeGoal . |
void |
setManyExecutions(boolean manyExecutions)
Mutator for manyExecutions . |
void |
setMeasureCpuTime(boolean measureCpuTime)
Mutator for measureCpuTime . |
void |
setNumberActions(long numberActions)
Mutator for numberActions . |
void |
setNumberMeasurements(int numberMeasurements)
Mutator for numberMeasurements . |
void |
setSdFractionThreshold(double sdFractionThreshold)
Mutator for sdFractionThreshold . |
void |
setWarmupTime(double warmupTime)
Mutator for warmupTime . |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean measureCpuTime
Default value is false
(i.e. measure elapsed time).
protected boolean manyExecutions
Benchmark.task
should be performed (as opposed to executing it just once).
In general, should be true
in order to obtain the most accurate results.
However, if either task
takes very long to execute,
or if it is desired to measure initialization effects like class loading and hotpsot warmup, then should be false
.
Default value is true
.
protected double warmupTime
manyExecutions
is true,
then specifies the minimum amount of time that should execute Benchmark.task
for before start recording measurements.
Units: seconds.
Contract: must be > 0, and is never NaN or infinite.
Default value is 10.0 (seconds), which is the minimum time recomended by Cliff Click, the HotSpot architect (see p. 33 of his 2002 JavaOne talk).
protected double executionTimeGoal
manyExecutions
is true
,
then is used to determine how many executions of Benchmark.task
to perform for each timing.
Specifically, for each measurement, task
must be executed enough times
to meet or exceed the amount of time specified here.
This value should be large enough that inaccuracy in timing measurements are small.
Since this class uses System.nanoTime
for its timings,
and this clock does not (across many platforms) reliably have better than a few 10s of ms accuracy,
this value should probably be at least 1 second in order to guarantee measurement error under 1%.
Only use a smaller value if you know that System.nanoTime
on all the platforms that you deploy on has greater accuracy.
Units: seconds.
Contract: must be > 0, and is never NaN or infinite.
Default value is 1 (second).
protected int numberMeasurements
manyExecutions
is true
,
then once Benchmark.numberExecutions
has been determined, specifies the number of timing measurements to perform.
Contract: must be > 0.
Default value is 60. The following considerations determined this value:
executionTimeGoal
, determines how long all of the measurements will take.
As discussed here,
you want the total benchmarking process to last at least 1 minute
in order to accurately sample garbage collection and object finalization behavior.
Given executionTimeGoal
's default value of 1 second, that means this value should be at least 60.
diagnoseSerialCorrelation
protected double cleanFractionThreshold
Contract: must be > 0, and is never NaN or infinite.
Default value is 0.01 (i.e. 1%).
protected double confidenceLevel
manyExecutions
is true
,
then specifies the confidence level to use when calculating the confidence intervals for the statistics.
The percent confidence level is 100 times this quantity.
Units: none, is a dimensionless number.
Contract: must be inside the open interval (0, 1), and is never NaN or infinite.
Default value is 0.95, the standard value used in statistics.
protected double sdFractionThreshold
Benchmark.statsBlock
which may be due to effects besides Benchmark.task
's intrinsic variation
before a warning is issued that the sd is too high.
Contract: must be > 0, and is never NaN or infinite.
Default value is 0.01 (i.e. 1%).
protected long numberActions
Benchmark.task
.
Only the user knows this number, hence it must be specifed by them.
The number of actions in each timing measurement is numberActions *
.
Benchmark.numberExecutions
The only effect of this value is on the reporting of action execution statistics.
An example of why this field is needed comes from measuring array element access times
where the task
internally loops once over an array of length n
.
To get the access time per element, numberActions
needs to be set equal to the array length.
Contract: must be > 0.
Default value is 1.
protected boolean consoleFeedback
Default value is true
.
protected boolean estimateNoiseFloor
Benchmark.noiseTask
will be run.
Default value is false
.
Constructor Detail |
---|
public Benchmark.Params()
public Benchmark.Params(boolean manyExecutions)
manyExecutions
to the corresponding field.
All other fields are left at their default initializations.
public Benchmark.Params(long numberActions) throws IllegalArgumentException
numberActions
to the corresponding field.
All other fields are left at their default initializations.
IllegalArgumentException
- if numberActions violates the field's contractpublic Benchmark.Params(boolean manyExecutions, long numberActions) throws IllegalArgumentException
IllegalArgumentException
- if any paramameter violates the field's contractMethod Detail |
---|
public boolean getMeasureCpuTime()
measureCpuTime
.
public void setMeasureCpuTime(boolean measureCpuTime)
measureCpuTime
.
public boolean getManyExecutions()
manyExecutions
.
public void setManyExecutions(boolean manyExecutions)
manyExecutions
.
public double getWarmupTime()
warmupTime
.
public void setWarmupTime(double warmupTime) throws IllegalArgumentException
warmupTime
.
IllegalArgumentException
- if warmupTime violates its contractpublic double getExecutionTimeGoal()
executionTimeGoal
.
public void setExecutionTimeGoal(double executionTimeGoal) throws IllegalArgumentException
executionTimeGoal
.
IllegalArgumentException
- if executionTimeGoal violates its contractpublic int getNumberMeasurements()
numberMeasurements
.
public void setNumberMeasurements(int numberMeasurements) throws IllegalArgumentException
numberMeasurements
.
IllegalArgumentException
- if numberMeasurements violates its contractpublic double getCleanFractionThreshold()
cleanFractionThreshold
.
public void setCleanFractionThreshold(double cleanFractionThreshold) throws IllegalArgumentException
cleanFractionThreshold
.
IllegalArgumentException
- if cleanFractionThreshold violates its contractpublic double getConfidenceLevel()
confidenceLevel
.
public void setConfidenceLevel(double confidenceLevel) throws IllegalArgumentException
confidenceLevel
.
IllegalArgumentException
- if confidenceLevel violates its contractpublic double getSdFractionThreshold()
sdFractionThreshold
.
public void setSdFractionThreshold(double sdFractionThreshold) throws IllegalArgumentException
sdFractionThreshold
.
IllegalArgumentException
- if sdFractionThreshold violates its contractpublic long getNumberActions()
numberActions
.
public void setNumberActions(long numberActions) throws IllegalArgumentException
numberActions
.
IllegalArgumentException
- if numberActions violates its contractpublic boolean getConsoleFeedback()
consoleFeedback
.
public void setConsoleFeedback(boolean consoleFeedback)
consoleFeedback
.
public boolean getEstimateNoiseFloor()
estimateNoiseFloor
.
public void setEstimateNoiseFloor(boolean estimateNoiseFloor)
estimateNoiseFloor
.
public Object clone()
Params
instance that contains equivalent data to this instance.
Any object fields are deep copied.
Every subclass must support cloning and must preserve this deep copy behavior.
clone
in class Object
public boolean equals(Object obj)
obj
's Class
is the same as this instance's Class
,
and every field of it equals that of this instance.
The choice was made to use the this.getClass() != obj.getClass()
idiom
instead of the !(obj instanceof Params)
idiom
in order to allow subclasses to override this method and obey the equals
contract.
The disadvantage of this idiom is behavior that can surprise users (no polymorphic equivalence is possible).
equals
in class Object
public int hashCode()
boolean
fields.
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |