@NotThreadSafe public class TimingInfo extends Object
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.
Modifier | Constructor and 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.
|
Modifier and Type | Method and 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 a
TimingInfoFullSupport 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 a
TimingInfoFullSupport 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 startTimeNano,
Long endTimeNano)
Returns an instance of
TimingInfo that is not modifiable, given
the start and end nano times. |
static TimingInfo |
unmodifiableTimingInfo(long startEpochTimeMilli,
long startTimeNano,
Long endTimeNano)
Returns an instance of
TimingInfo that is not modifiable. |
protected TimingInfo(Long startEpochTimeMilli, long startTimeNano, Long endTimeNano)
startEpochTimeMilli
- start time since epoch in millisecondstartTimeNano
- start time in nanosecondendTimeNano
- end time in nanosecond; or null if not knownpublic static TimingInfo startTiming()
public static TimingInfo startTimingFullSupport()
public static TimingInfo startTimingFullSupport(long startTimeNano)
startTimeNano
- start time in nanosecondpublic static TimingInfo newTimingInfoFullSupport(long startTimeNano, long endTimeNano)
TimingInfoFullSupport
based on the given
start and end time in nanosecond, ignoring the wall clock time.startTimeNano
- start time in nanosecondendTimeNano
- end time in nanosecondpublic static TimingInfo newTimingInfoFullSupport(long startEpochTimeMilli, long startTimeNano, long endTimeNano)
TimingInfoFullSupport
based on the given
start time since epoch in millisecond,
and the given start and end time in nanosecond.startEpochTimeMilli
- start time since epoch in millisecondstartTimeNano
- start time in nanosecondendTimeNano
- end time in nanosecondpublic static TimingInfo unmodifiableTimingInfo(long startTimeNano, Long endTimeNano)
TimingInfo
that is not modifiable, given
the start and end nano times.public static TimingInfo unmodifiableTimingInfo(long startEpochTimeMilli, long startTimeNano, Long endTimeNano)
TimingInfo
that is not modifiable.startEpochTimeMilli
- start time since epoch in millisecondstartTimeNano
- start time in nanosecondendTimeNano
- end time in nanosecond; or null if not known@Deprecated public final long getStartTime()
@Deprecated public final long getStartEpochTimeMilli()
public final Long getStartEpochTimeMilliIfKnown()
public final long getStartTimeNano()
@Deprecated public final long getEndTime()
@Deprecated public final long getEndEpochTimeMilli()
public final Long getEndEpochTimeMilliIfKnown()
public final long getEndTimeNano()
public final Long getEndTimeNanoIfKnown()
@Deprecated public final double getTimeTakenMillis()
public final Double getTimeTakenMillisIfKnown()
public static double durationMilliOf(long startTimeNano, long endTimeNano)
@Deprecated public final long getElapsedTimeMillis()
public final boolean isEndTimeKnown()
public final boolean isStartEpochTimeMilliKnown()
@Deprecated public void setEndTime(long endTimeMilli)
public void setEndTimeNano(long endTimeNano)
public TimingInfo endTiming()
public void addSubMeasurement(String subMeasurementName, TimingInfo timingInfo)
public TimingInfo getSubMeasurement(String subMeasurementName)
public TimingInfo getSubMeasurement(String subMesurementName, int index)
public TimingInfo getLastSubMeasurement(String subMeasurementName)
public List<TimingInfo> getAllSubMeasurements(String subMeasurementName)
public Map<String,List<TimingInfo>> getSubMeasurementsByName()
public void setCounter(String key, long count)
public void incrementCounter(String key)
Copyright © 2017. All rights reserved.