Inline Histogram.resetLocked function

This commit is contained in:
Aliaksandr Valialkin 2021-03-16 12:14:36 +02:00
parent cea3ca311b
commit 98a1807528

View File

@ -60,11 +60,6 @@ type Histogram struct {
// Reset resets the given histogram. // Reset resets the given histogram.
func (h *Histogram) Reset() { func (h *Histogram) Reset() {
h.mu.Lock() h.mu.Lock()
h.resetLocked()
h.mu.Unlock()
}
func (h *Histogram) resetLocked() {
for _, db := range h.decimalBuckets[:] { for _, db := range h.decimalBuckets[:] {
if db == nil { if db == nil {
continue continue
@ -76,6 +71,7 @@ func (h *Histogram) resetLocked() {
h.lower = 0 h.lower = 0
h.upper = 0 h.upper = 0
h.sum = 0 h.sum = 0
h.mu.Unlock()
} }
// Update updates h with v. // Update updates h with v.