Documentation ¶
Index ¶
- type LatencyRecorder
- func (p *LatencyRecorder) Format() string
- func (p *LatencyRecorder) GetLatencyMap() map[string]time.Duration
- func (p *LatencyRecorder) Mark(name string)
- func (p *LatencyRecorder) MarkFromStartTime(name string)
- func (p *LatencyRecorder) MarkWithStartTime(name string, start time.Time)
- func (p *LatencyRecorder) Reset()
- func (p *LatencyRecorder) WriteTo(w io.Writer) (n int64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LatencyRecorder ¶
type LatencyRecorder struct {
// contains filtered or unexported fields
}
LatencyRecorder helps to record operation latencies.
func NewLatencyRecorder ¶
func NewLatencyRecorder() *LatencyRecorder
NewLatencyRecorder creates a new LatencyRecorder.
func (*LatencyRecorder) Format ¶
func (p *LatencyRecorder) Format() string
Format formats the recorded latencies into a string, which can be sent to log by a logger.
func (*LatencyRecorder) GetLatencyMap ¶
func (p *LatencyRecorder) GetLatencyMap() map[string]time.Duration
GetLatencyMap returns a map of all recorded latencies.
func (*LatencyRecorder) Mark ¶
func (p *LatencyRecorder) Mark(name string)
Mark records latency of an operation, from the previous operation, or from the startTime if this is the first calling. It is designed to record each operation latency one by one in synchronous operations.
func (*LatencyRecorder) MarkFromStartTime ¶
func (p *LatencyRecorder) MarkFromStartTime(name string)
MarkFromStartTime records latency of an operation, from the startTime, it does not affect recording of calling Mark.
func (*LatencyRecorder) MarkWithStartTime ¶
func (p *LatencyRecorder) MarkWithStartTime(name string, start time.Time)
MarkWithStartTime records latency of an operation, from the given time, it does not affect recording of calling Mark.
func (*LatencyRecorder) Reset ¶
func (p *LatencyRecorder) Reset()
Reset resets the recorder to initial state, which is ready to be reused.