mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
feat: tweak a bit
This commit is contained in:
parent
0554ea3589
commit
e331197ccd
1 changed files with 3 additions and 3 deletions
|
|
@ -99,14 +99,14 @@ func (t *StandardTimer) Stop() {
|
||||||
t.meter.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()) {
|
func (t *StandardTimer) Time(f func()) {
|
||||||
ts := time.Now()
|
ts := time.Now()
|
||||||
f()
|
f()
|
||||||
t.Update(time.Since(ts))
|
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) {
|
func (t *StandardTimer) Update(d time.Duration) {
|
||||||
t.mutex.Lock()
|
t.mutex.Lock()
|
||||||
defer t.mutex.Unlock()
|
defer t.mutex.Unlock()
|
||||||
|
|
@ -114,7 +114,7 @@ func (t *StandardTimer) Update(d time.Duration) {
|
||||||
t.meter.Mark(1)
|
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.
|
// The record uses nanoseconds.
|
||||||
func (t *StandardTimer) UpdateSince(ts time.Time) {
|
func (t *StandardTimer) UpdateSince(ts time.Time) {
|
||||||
t.Update(time.Since(ts))
|
t.Update(time.Since(ts))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue