Snapshot resets the timer and returns a read-only copy of its contents.
()
| 98 | |
| 99 | // Snapshot resets the timer and returns a read-only copy of its contents. |
| 100 | func (t *StandardResettingTimer) Snapshot() ResettingTimer { |
| 101 | t.mutex.Lock() |
| 102 | defer t.mutex.Unlock() |
| 103 | currentValues := t.values |
| 104 | t.values = make([]int64, 0, InitialResettingTimerSliceCap) |
| 105 | |
| 106 | return &ResettingTimerSnapshot{ |
| 107 | values: currentValues, |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | // Percentiles panics. |
| 112 | func (t *StandardResettingTimer) Percentiles([]float64) []int64 { |