Contents
Class TimeDistributionRecorder
java.lang.Object
com.hypixel.hytale.common.benchmark.ContinuousValueRecorder
com.hypixel.hytale.common.benchmark.TimeRecorder
com.hypixel.hytale.common.benchmark.TimeDistributionRecorder
Utility class to collect distribution of timings with a logarithmic time scale.
Returns minimum, maximum and average time of sampled intervals. Also returns distribution of samples between intervals on a logarithmic time scale.
- Since:
- 2018-01-04
-
Field Summary
Fields inherited from class TimeRecorder
DEFAULT_COLUMN_FORMAT_HEADER, DEFAULT_COLUMN_FORMAT_VALUE, DEFAULT_COLUMN_SEPARATOR, DEFAULT_COLUMNS, NANOS_TO_SECONDS -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for TimeDistributionRecorder.TimeDistributionRecorder(double maxSecs, double minSecs) Constructor for TimeDistributionRecorder.TimeDistributionRecorder(double maxSecs, double minSecs, int logSteps) Constructor for TimeDistributionRecorder. -
Method Summary
Modifier and TypeMethodDescriptionvoidformatHeader(Formatter formatter, String columnFormatHeader) voidformatValues(Formatter formatter, long normalValue) voidformatValues(Formatter formatter, long normalValue, String columnFormatValue) voidformatValues(Formatter formatter, String columnFormatValue) longget(int index) Return count of values for a bin.doubleindexToTime(int index) Compute the minimum sample value for a bin by bin index.doublerecordNanos(long nanos) Record a time sample of given length.voidreset()Reset all recorded values.intsize()Return number of bins.inttimeToIndex(double secs) Compute the bin index of a given time span.toString()Methods inherited from class TimeRecorder
end, formatHeader, formatTime, formatValues, startMethods inherited from class ContinuousValueRecorder
getAverage, getAverage, getCount, getMaxValue, getMaxValue, getMinValue, getMinValue, record
-
Constructor Details
-
TimeDistributionRecorder
public TimeDistributionRecorder(double maxSecs, double minSecs, int logSteps) Constructor for TimeDistributionRecorder.- Parameters:
maxSecs- Largest time to be recorded (will be rounded up to next power of 10)minSecs- Smallest time to be recorded (will be rounded down to next power of 10)logSteps- Number of subdivisions per power of 10 (logarithmic spaced)
-
TimeDistributionRecorder
public TimeDistributionRecorder(double maxSecs, double minSecs) Constructor for TimeDistributionRecorder.Uses default of 5 steps per power of 10.
- Parameters:
maxSecs- Largest time to be recorded (will be rounded up to next power of 10)minSecs- Smallest time to be recorded (will be rounded down to next power of 10)
-
TimeDistributionRecorder
public TimeDistributionRecorder()Constructor for TimeDistributionRecorder.Uses default of 5 steps per power of 10 and a range from 1/10 to 1e-5 seconds.
-
-
Method Details
-
reset
public void reset()Description copied from class:ContinuousValueRecorderReset all recorded values.- Overrides:
resetin classContinuousValueRecorder
-
recordNanos
public double recordNanos(long nanos) Description copied from class:TimeRecorderRecord a time sample of given length.- Overrides:
recordNanosin classTimeRecorder- Parameters:
nanos- Sample interval in nano seconds to record- Returns:
- Sample interval in seconds
-
timeToIndex
public int timeToIndex(double secs) Compute the bin index of a given time span.- Parameters:
secs- Time span in seconds- Returns:
- Index of bin for time interval
-
indexToTime
public double indexToTime(int index) Compute the minimum sample value for a bin by bin index.All values for the bin are guaranteed to be larger or equal than this value and less than the minimum of any previous bin. The last bin always has a minimum of 0.
- Parameters:
index- Bin index- Returns:
- Minimum time in seconds
-
size
public int size()Return number of bins.- Returns:
- Integer count
-
get
public long get(int index) Return count of values for a bin.- Parameters:
index- Bin index- Returns:
- Long count
-
toString
- Overrides:
toStringin classTimeRecorder
-
formatHeader
- Overrides:
formatHeaderin classTimeRecorder
-
formatValues
- Overrides:
formatValuesin classTimeRecorder
-
formatValues
-
formatValues
-