Package org.openjdk.jmh.results
Class Result<T extends Result<T>>
- java.lang.Object
-
- org.openjdk.jmh.results.Result<T>
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
AverageTimeResult,LinuxPerfProfiler.PerfResult,PausesProfiler.PausesProfilerResult,SafepointsProfiler.SafepointProfilerResult,SampleTimeResult,ScalarDerivativeResult,ScalarResult,SingleShotResult,StackProfiler.StackResult,TextResult,ThroughputResult
public abstract class Result<T extends Result<T>> extends java.lang.Object implements java.io.SerializableBase class for all types of results that can be returned by a benchmark.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classResult.LazyProps
-
Field Summary
Fields Modifier and Type Field Description private static Deduplicator<java.lang.String>DEDUPprotected java.lang.Stringlabelprotected AggregationPolicypolicyprotected ResultRoleroleprivate static longserialVersionUIDprotected Statisticsstatisticsprotected java.lang.Stringunit
-
Constructor Summary
Constructors Constructor Description Result(ResultRole role, java.lang.String label, Statistics s, java.lang.String unit, AggregationPolicy policy)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringdistributionExtendedInfo()java.lang.StringextendedInfo()Print extended result informationprotected java.util.Collection<? extends Result>getDerivativeResults()protected abstract Aggregator<T>getIterationAggregator()Iteration aggregator combines the iteration results into benchmar result.java.lang.StringgetLabel()Return the result label.ResultRolegetRole()Return the result role.longgetSampleCount()Get number of samples in the current result.doublegetScore()The score for this result.double[]getScoreConfidence()The score confidence interval for this result.doublegetScoreError()The score error for this result.java.lang.StringgetScoreUnit()The unit of the score for this result.StatisticsgetStatistics()Return the statistics holding the subresults' values.protected abstract Aggregator<T>getThreadAggregator()Thread aggregator combines the thread results into iteration result.protected TgetZeroResult()Returns "0" result.protected static Statisticsof(double v)private voidprintHisto(Statistics stats, java.lang.StringBuilder sb)private voidprintPercentiles(Statistics stats, java.lang.StringBuilder sb)protected java.lang.StringsimpleExtendedInfo()java.lang.StringtoString()Result as represented by a String.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
DEDUP
private static final Deduplicator<java.lang.String> DEDUP
-
role
protected final ResultRole role
-
label
protected final java.lang.String label
-
unit
protected final java.lang.String unit
-
statistics
protected final Statistics statistics
-
policy
protected final AggregationPolicy policy
-
-
Constructor Detail
-
Result
public Result(ResultRole role, java.lang.String label, Statistics s, java.lang.String unit, AggregationPolicy policy)
-
-
Method Detail
-
of
protected static Statistics of(double v)
-
getLabel
public java.lang.String getLabel()
Return the result label.- Returns:
- result label
-
getRole
public ResultRole getRole()
Return the result role.- Returns:
- result role
-
getStatistics
public Statistics getStatistics()
Return the statistics holding the subresults' values.This method returns raw samples. The aggregation policy decides how to get the score out of these raw samples. Use
getScore(),getScoreError(), andgetScoreConfidence()for scalar results.- Returns:
- statistics
-
getScoreUnit
public final java.lang.String getScoreUnit()
The unit of the score for this result.- Returns:
- String representation of the unit
-
getScore
public double getScore()
The score for this result.- Returns:
- double representing the score
- See Also:
getScoreError()
-
getScoreError
public double getScoreError()
The score error for this result.- Returns:
- score error, if available
- See Also:
getScore()
-
getScoreConfidence
public double[] getScoreConfidence()
The score confidence interval for this result.- Returns:
- score confidence interval, if available; if not, the CI will match
getScore() - See Also:
getScore()
-
getSampleCount
public long getSampleCount()
Get number of samples in the current result.- Returns:
- number of samples
-
getThreadAggregator
protected abstract Aggregator<T> getThreadAggregator()
Thread aggregator combines the thread results into iteration result.- Returns:
- thread aggregator
-
getIterationAggregator
protected abstract Aggregator<T> getIterationAggregator()
Iteration aggregator combines the iteration results into benchmar result.- Returns:
- iteration aggregator
-
getZeroResult
protected T getZeroResult()
Returns "0" result. This is used for un-biased aggregation of secondary results. For instance, profilers might omit results in some iterations, thus we should pretend there were 0 results.- Returns:
- result that represents "empty" result, null if no sensible "empty" result can be created
-
getDerivativeResults
protected java.util.Collection<? extends Result> getDerivativeResults()
- Returns:
- derivative results for this result. These do not participate in aggregation, and computed on the spot from the aggregated result.
-
toString
public java.lang.String toString()
Result as represented by a String.- Overrides:
toStringin classjava.lang.Object- Returns:
- String with the result and unit
-
extendedInfo
public java.lang.String extendedInfo()
Print extended result information- Returns:
- String with extended info
-
simpleExtendedInfo
protected java.lang.String simpleExtendedInfo()
-
distributionExtendedInfo
protected java.lang.String distributionExtendedInfo()
-
printPercentiles
private void printPercentiles(Statistics stats, java.lang.StringBuilder sb)
-
printHisto
private void printHisto(Statistics stats, java.lang.StringBuilder sb)
-
-