Contents
Class TimeRecorder
java.lang.Object
com.hypixel.hytale.common.benchmark.ContinuousValueRecorder
com.hypixel.hytale.common.benchmark.TimeRecorder
- Direct Known Subclasses:
TimeDistributionRecorder
Utility class to collect min, max and average of time value.
- Since:
- 2018-08-10
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleend(long start) End and record a time sample.voidformatHeader(Formatter formatter) voidformatHeader(Formatter formatter, String columnFormatHeader) static StringformatTime(double secs) Convert a fractional time in seconds to a string with unit.voidformatValues(Formatter formatter) voidformatValues(Formatter formatter, String columnFormatValue) doublerecordNanos(long nanos) Record a time sample of given length.longstart()Start a time sample.toString()Methods inherited from class ContinuousValueRecorder
getAverage, getAverage, getCount, getMaxValue, getMaxValue, getMinValue, getMinValue, record, reset
-
Field Details
-
DEFAULT_COLUMN_SEPARATOR
- See Also:
-
DEFAULT_COLUMN_FORMAT_HEADER
- See Also:
-
DEFAULT_COLUMN_FORMAT_VALUE
- See Also:
-
DEFAULT_COLUMNS
-
NANOS_TO_SECONDS
public static final double NANOS_TO_SECONDS- See Also:
-
-
Constructor Details
-
TimeRecorder
public TimeRecorder()
-
-
Method Details
-
start
public long start()Start a time sample.- Returns:
- Value to be passed to end call
-
end
public double end(long start) End and record a time sample.- Parameters:
start- value as returned from start call- Returns:
- Seconds passed between start and end
-
recordNanos
public double recordNanos(long nanos) Record a time sample of given length.- Parameters:
nanos- Sample interval in nano seconds to record- Returns:
- Sample interval in seconds
-
toString
-
formatTime
Convert a fractional time in seconds to a string with unit.- Parameters:
secs- Seconds- Returns:
- String with value (at least 2 significant digits) and unit (seconds, milli, micro, nano)
-
formatHeader
-
formatHeader
-
formatValues
-
formatValues
-