feat: tweak a bit

This commit is contained in:
georgehao 2024-03-17 21:33:04 +08:00
parent 0554ea3589
commit e331197ccd
No known key found for this signature in database

View file

@ -99,14 +99,14 @@ func (t *StandardTimer) Stop() {
t.meter.Stop()
}
// Time Record the duration of the execution of the given function.
// Time record the duration of the execution of the given function.
func (t *StandardTimer) Time(f func()) {
ts := time.Now()
f()
t.Update(time.Since(ts))
}
// Update Record the duration of an event, in nanoseconds.
// Update record the duration of an event, in nanoseconds.
func (t *StandardTimer) Update(d time.Duration) {
t.mutex.Lock()
defer t.mutex.Unlock()
@ -114,7 +114,7 @@ func (t *StandardTimer) Update(d time.Duration) {
t.meter.Mark(1)
}
// UpdateSince Record the duration of an event that started at a time and ends now.
// UpdateSince record the duration of an event that started at a time and ends now.
// The record uses nanoseconds.
func (t *StandardTimer) UpdateSince(ts time.Time) {
t.Update(time.Since(ts))