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) |
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()
Retrieves the start epoch time in milliseconds if known.
|
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) |
static TimingInfo |
unmodifiableTimingInfo(long startEpochTimeMilli,
long startTimeNano,
Long endTimeNano) |
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)
startTimeNano
- start time nano.endTimeNano
- end time nano.TimingInfo
that is not modifiable, given
the start and end nano times.public static TimingInfo unmodifiableTimingInfo(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 knownTimingInfo
that is not modifiable.@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)
startTimeNano
- start time nano.endTimeNano
- end time nano.@Deprecated public final long getElapsedTimeMillis()
public final boolean isEndTimeKnown()
public final boolean isStartEpochTimeMilliKnown()
@Deprecated public void setEndTime(long endTimeMilli)
public void setEndTimeNano(long endTimeNano)
endTimeNano
- the end time nano.public TimingInfo endTiming()
public void addSubMeasurement(String subMeasurementName, TimingInfo timingInfo)
subMeasurementName
- the sub measurement name.timingInfo
- the timing info.public TimingInfo getSubMeasurement(String subMeasurementName)
subMeasurementName
- the sub measurement name.public TimingInfo getSubMeasurement(String subMesurementName, int index)
subMesurementName
- the sub measurement name.index
- the index.public TimingInfo getLastSubMeasurement(String subMeasurementName)
subMeasurementName
- the sub measurement name.public List<TimingInfo> getAllSubMeasurements(String subMeasurementName)
subMeasurementName
- the sub measurement name.public Map<String,List<TimingInfo>> getSubMeasurementsByName()
public void setCounter(String key, long count)
key
- the key.count
- the count.public void incrementCounter(String key)
key
- the key.Copyright © 2018. All rights reserved.