Package com.amazonaws.util
Class TimingInfo
- java.lang.Object
-
- com.amazonaws.util.TimingInfo
-
public class TimingInfo extends Object
Used both as a base class and a minimal support of timing info.In contrast to
TimingInfoFullSupport
, which is intended to be a full support of the timing info, this class only provides a minimal support of start and end time (ie with no-ops for sub-event measurements) for backward compatiblity reasons.This class is instantiated instead of
TimingInfoFullSupport
when request metric collection is not required during a particular service request/response cycle.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TimingInfo(Long startEpochTimeMilli, long startTimeNano, Long endTimeNano)
A private ctor to facilitate the deprecation of using millisecond and migration to using nanosecond for timing measurement.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addSubMeasurement(String subMeasurementName, TimingInfo timingInfo)
static double
durationMilliOf(long startTimeNano, long endTimeNano)
Returns the duration in milliseconds as double, preserving the decimal precision as necessary, for the given start and end time in nanoseconds.TimingInfo
endTiming()
Map<String,Number>
getAllCounters()
List<TimingInfo>
getAllSubMeasurements(String subMeasurementName)
Number
getCounter(String key)
long
getElapsedTimeMillis()
Deprecated.long
getEndEpochTimeMilli()
Deprecated.Long
getEndEpochTimeMilliIfKnown()
long
getEndTime()
Deprecated.long
getEndTimeNano()
Long
getEndTimeNanoIfKnown()
TimingInfo
getLastSubMeasurement(String subMeasurementName)
long
getStartEpochTimeMilli()
Deprecated.Long
getStartEpochTimeMilliIfKnown()
long
getStartTime()
Deprecated.long
getStartTimeNano()
TimingInfo
getSubMeasurement(String subMeasurementName)
TimingInfo
getSubMeasurement(String subMesurementName, int index)
Map<String,List<TimingInfo>>
getSubMeasurementsByName()
double
getTimeTakenMillis()
Deprecated.Double
getTimeTakenMillisIfKnown()
void
incrementCounter(String key)
boolean
isEndTimeKnown()
boolean
isStartEpochTimeMilliKnown()
static TimingInfo
newTimingInfoFullSupport(long startTimeNano, long endTimeNano)
Returns aTimingInfoFullSupport
based on the given start and end time in nanosecond, ignoring the wall clock time.static TimingInfo
newTimingInfoFullSupport(long startEpochTimeMilli, long startTimeNano, long endTimeNano)
Returns aTimingInfoFullSupport
based on the given start time since epoch in millisecond, and the given start and end time in nanosecond.void
setCounter(String key, long count)
void
setEndTime(long endTimeMilli)
Deprecated.void
setEndTimeNano(long endTimeNano)
static TimingInfo
startTiming()
Captures the current wall clock time (since epoch in millisecond) and the current time (in nanosecond) used for timing measurement.static TimingInfo
startTimingFullSupport()
Captures the current wall clock time (since epoch in millisecond) and the current time (in nanosecond) used for timing measurement.static TimingInfo
startTimingFullSupport(long startTimeNano)
Captures the given start time in nanosecond, ignoring the wall clock time.String
toString()
static TimingInfo
unmodifiableTimingInfo(long startEpochTimeMilli, long startTimeNano, Long endTimeNano)
Returns an instance ofTimingInfo
that is not modifiable.static TimingInfo
unmodifiableTimingInfo(long startTimeNano, Long endTimeNano)
Returns an instance ofTimingInfo
that is not modifiable, given the start and end nano times.
-
-
-
Constructor Detail
-
TimingInfo
protected TimingInfo(Long startEpochTimeMilli, long startTimeNano, Long endTimeNano)
A private ctor to facilitate the deprecation of using millisecond and migration to using nanosecond for timing measurement.- Parameters:
startEpochTimeMilli
- start time since epoch in millisecondstartTimeNano
- start time in nanosecondendTimeNano
- end time in nanosecond; or null if not known
-
-
Method Detail
-
startTiming
public static TimingInfo startTiming()
Captures the current wall clock time (since epoch in millisecond) and the current time (in nanosecond) used for timing measurement. For more info, see: https://blogs.oracle.com/dholmes/entry/inside_the_hotspot_vm_clocks
-
startTimingFullSupport
public static TimingInfo startTimingFullSupport()
Captures the current wall clock time (since epoch in millisecond) and the current time (in nanosecond) used for timing measurement. For more info, see: https://blogs.oracle.com/dholmes/entry/inside_the_hotspot_vm_clocks
-
startTimingFullSupport
public static TimingInfo startTimingFullSupport(long startTimeNano)
Captures the given start time in nanosecond, ignoring the wall clock time.- Parameters:
startTimeNano
- start time in nanosecond
-
newTimingInfoFullSupport
public static TimingInfo newTimingInfoFullSupport(long startTimeNano, long endTimeNano)
Returns aTimingInfoFullSupport
based on the given start and end time in nanosecond, ignoring the wall clock time.- Parameters:
startTimeNano
- start time in nanosecondendTimeNano
- end time in nanosecond
-
newTimingInfoFullSupport
public static TimingInfo newTimingInfoFullSupport(long startEpochTimeMilli, long startTimeNano, long endTimeNano)
Returns aTimingInfoFullSupport
based on the given start time since epoch in millisecond, and the given start and end time in nanosecond.- Parameters:
startEpochTimeMilli
- start time since epoch in millisecondstartTimeNano
- start time in nanosecondendTimeNano
- end time in nanosecond
-
unmodifiableTimingInfo
public static TimingInfo unmodifiableTimingInfo(long startTimeNano, Long endTimeNano)
Returns an instance ofTimingInfo
that is not modifiable, given the start and end nano times.
-
unmodifiableTimingInfo
public static TimingInfo unmodifiableTimingInfo(long startEpochTimeMilli, long startTimeNano, Long endTimeNano)
Returns an instance ofTimingInfo
that is not modifiable.- Parameters:
startEpochTimeMilli
- start time since epoch in millisecondstartTimeNano
- start time in nanosecondendTimeNano
- end time in nanosecond; or null if not known
-
getStartTime
@Deprecated public final long getStartTime()
Deprecated.
-
getStartEpochTimeMilli
@Deprecated public final long getStartEpochTimeMilli()
Deprecated.
-
getStartEpochTimeMilliIfKnown
public final Long getStartEpochTimeMilliIfKnown()
-
getStartTimeNano
public final long getStartTimeNano()
-
getEndTime
@Deprecated public final long getEndTime()
Deprecated.
-
getEndEpochTimeMilli
@Deprecated public final long getEndEpochTimeMilli()
Deprecated.
-
getEndEpochTimeMilliIfKnown
public final Long getEndEpochTimeMilliIfKnown()
-
getEndTimeNano
public final long getEndTimeNano()
-
getEndTimeNanoIfKnown
public final Long getEndTimeNanoIfKnown()
-
getTimeTakenMillis
@Deprecated public final double getTimeTakenMillis()
Deprecated.
-
getTimeTakenMillisIfKnown
public final Double getTimeTakenMillisIfKnown()
-
durationMilliOf
public static double durationMilliOf(long startTimeNano, long endTimeNano)
Returns the duration in milliseconds as double, preserving the decimal precision as necessary, for the given start and end time in nanoseconds.
-
getElapsedTimeMillis
@Deprecated public final long getElapsedTimeMillis()
Deprecated.
-
isEndTimeKnown
public final boolean isEndTimeKnown()
-
isStartEpochTimeMilliKnown
public final boolean isStartEpochTimeMilliKnown()
-
setEndTime
@Deprecated public void setEndTime(long endTimeMilli)
Deprecated.
-
setEndTimeNano
public void setEndTimeNano(long endTimeNano)
-
endTiming
public TimingInfo endTiming()
-
addSubMeasurement
public void addSubMeasurement(String subMeasurementName, TimingInfo timingInfo)
-
getSubMeasurement
public TimingInfo getSubMeasurement(String subMeasurementName)
-
getSubMeasurement
public TimingInfo getSubMeasurement(String subMesurementName, int index)
-
getLastSubMeasurement
public TimingInfo getLastSubMeasurement(String subMeasurementName)
-
getAllSubMeasurements
public List<TimingInfo> getAllSubMeasurements(String subMeasurementName)
-
getSubMeasurementsByName
public Map<String,List<TimingInfo>> getSubMeasurementsByName()
-
setCounter
public void setCounter(String key, long count)
-
incrementCounter
public void incrementCounter(String key)
-
-