mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
metrics: oblige nitpicks from review
This commit is contained in:
parent
878680ee23
commit
7d352f8acc
1 changed files with 7 additions and 8 deletions
|
|
@ -83,14 +83,14 @@ func (s *ExpDecaySample) Clear() {
|
|||
func (s *ExpDecaySample) Snapshot() SampleSnapshot {
|
||||
s.mutex.Lock()
|
||||
defer s.mutex.Unlock()
|
||||
vals := s.values.Values()
|
||||
values := make([]int64, len(vals))
|
||||
var (
|
||||
samples = s.values.Values()
|
||||
values = make([]int64, len(samples))
|
||||
max int64 = math.MinInt64
|
||||
min int64 = math.MaxInt64
|
||||
sum int64
|
||||
)
|
||||
for i, item := range vals {
|
||||
for i, item := range samples {
|
||||
v := item.v
|
||||
values[i] = v
|
||||
sum += v
|
||||
|
|
@ -196,8 +196,7 @@ type sampleSnapshot struct {
|
|||
|
||||
// newSampleSnapshotPrecalculated creates a read-only sampleSnapShot, using
|
||||
// precalculated sums to avoid iterating the values
|
||||
func newSampleSnapshotPrecalculated(count int64, values []int64,
|
||||
min, max, sum int64) *sampleSnapshot {
|
||||
func newSampleSnapshotPrecalculated(count int64, values []int64, min, max, sum int64) *sampleSnapshot {
|
||||
if len(values) == 0 {
|
||||
return &sampleSnapshot{
|
||||
count: count,
|
||||
|
|
|
|||
Loading…
Reference in a new issue