Class LatencyRecord
- java.lang.Object
-
- com.kristensoft.kdc.LatencyRecord
-
- All Implemented Interfaces:
Serializable
public class LatencyRecord extends Object implements Serializable
Contains latency measurements collected during KDC agent communication and processing.A latency record stores start and stop timestamps for the metrics associated with a
LatencyContext. The context defines which metrics are recorded and their ordering.Timestamps are measured in nanoseconds using
System.nanoTime().Advanced users may inspect the latency context and timestamp arrays to analyze individual stages of agent processing. The recording and management of timestamps are handled internally by KDC.
Latency records may be serialized and transmitted with agents and replies.
Depending on the communication context, some measurements may not be available until processing has completed. For synchronous operations, measurements may include both sending and receiving activities.
A timestamp value of
0Lindicates that a measurement has not been recorded. A start and stop timestamp pair of1Lindicates that the metric is not applicable.- Author:
- Charles B. Kozoyed
- See Also:
LatencyContext,LatencyMetric, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LatencyRecord()Constructs an empty latency record.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LatencyContextgetLatencyContext()Returns the latency context associated with this record.long[]getStartTimeLine()Returns a copy of the recorded start timestamps.long[]getStopTimeLine()Returns a copy of the recorded stop timestamps.booleanisComplete()Determines whether all metrics associated with this record have valid start and stop timestamps.
-
-
-
Method Detail
-
isComplete
public boolean isComplete()
Determines whether all metrics associated with this record have valid start and stop timestamps.- Returns:
trueif all metrics have valid timestamps;falseotherwise
-
getLatencyContext
public LatencyContext getLatencyContext()
Returns the latency context associated with this record.The context identifies the metrics represented by the timestamp arrays and their ordering.
- Returns:
- the latency context, or
nullif not initialized - See Also:
LatencyContext.getMetrics()
-
getStartTimeLine
public long[] getStartTimeLine()
Returns a copy of the recorded start timestamps.Array positions correspond to the ordered metrics returned by
LatencyContext.getMetrics().Modifying the returned array does not affect this record. Returns a copy of the recorded start timestamps.
Array positions correspond to the ordered metrics returned by
LatencyContext.getMetrics().This method requires an initialized latency record. Calling it before the timestamp arrays have been populated may result in a
NullPointerException.- Returns:
- a defensive copy of the start timestamp array
-
getStopTimeLine
public long[] getStopTimeLine()
Returns a copy of the recorded stop timestamps.Array positions correspond to the ordered metrics returned by
LatencyContext.getMetrics().Modifying the returned array does not affect this record.
Array positions correspond to the ordered metrics returned by
LatencyContext.getMetrics().This method requires an initialized latency record. Calling it before the timestamp arrays have been populated may result in a
NullPointerException.- Returns:
- a defensive copy of the stop timestamp array
-
-