Class RequestTimers¶
Defined in File common.h
Class Documentation¶
-
class
RequestTimers
¶ Records timestamps for different stages of request handling.
Public Types
-
enum
Kind
¶ Timestamp kinds.
Values:
-
REQUEST_START
¶ The start of request handling.
-
REQUEST_END
¶ The end of request handling.
-
SEND_START
¶ The start of sending request bytes to the server (i.e.
first byte).
-
SEND_END
¶ The end of sending request bytes to the server (i.e.
last byte).
-
RECV_START
¶ The start of receiving response bytes from the server (i.e.
first byte).
-
RECV_END
¶ The end of receiving response bytes from the server (i.e.
last byte).
-
COUNT__
¶
-
Public Functions
-
RequestTimers
()¶ Construct a timer with zero-ed timestamps.
-
void
Reset
()¶ Reset all timestamp values to zero.
Must be called before re-using the timer.
-
uint64_t
Timestamp
(Kind kind) const¶ Get the timestamp, in nanoseconds, for a kind.
- Return
The timestamp in nanoseconds.
- Parameters
kind
: The timestamp kind.
-
uint64_t
CaptureTimestamp
(Kind kind)¶ Set a timestamp to the current time, in nanoseconds.
- Return
The timestamp in nanoseconds.
- Parameters
kind
: The timestamp kind.
-
uint64_t
Duration
(Kind start, Kind end) const¶ Return the duration between start time point and end timepoint in nanosecond.
- Return
Duration in nanosecond, or std::numeric_limits<uint64_t>::max to indicate that duration could not be calculated.
- Parameters
start
: The start time point.end
: The end time point.
-
enum