MCPcopy
hub / github.com/grpc/grpc-go / NewTimer

Function NewTimer

internal/profiling/profiling.go:96–102  ·  view source on GitHub ↗

NewTimer creates and returns a new Timer object. This is useful when you don't already have a Stat object to associate this Timer with; for example, before the context of a new RPC query is created, a Timer may be needed to measure transport-related operations. Use AppendTimer to append the returne

(tags string)

Source from the content-addressed store, hash-verified

94//
95// Use AppendTimer to append the returned Timer to a Stat.
96func NewTimer(tags string) *Timer {
97 return &Timer{
98 Tags: tags,
99 Begin: time.Now(),
100 GoID: goid(),
101 }
102}
103
104// Egress sets the End field of a timer to the current time.
105func (timer *Timer) Egress() {

Callers 2

TestProfilingMethod · 0.85
TestProfilingRaceMethod · 0.85

Calls 2

NowMethod · 0.80
goidFunction · 0.70

Tested by 2

TestProfilingMethod · 0.68
TestProfilingRaceMethod · 0.68