You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funcTimeMe() {
timer:=NewTimer(myHistogram)
defertimer.ObserveDuration()
// Do actual work.
}
I find that I typically want to also emit durations in log statements. Therefore it would be useful if ObserveDuration() returned the observed duration (probably as a time.Duration, but I could see a case being made for the value as a float64), which would allow code like the following:
funcTimeMe() {
timer:=NewTimer(myHistogram)
deferfunc() { log.Printf("finished in %f seconds", timer.ObserveDuration().Seconds()) }()
// Do actual work.
}
The text was updated successfully, but these errors were encountered:
The following usage example is given in the docs:
I find that I typically want to also emit durations in log statements. Therefore it would be useful if
ObserveDuration()
returned the observed duration (probably as atime.Duration
, but I could see a case being made for the value as afloat64
), which would allow code like the following:The text was updated successfully, but these errors were encountered: