github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/storage/tree/minval.go (about)

     1  package tree
     2  
     3  import (
     4  	"github.com/pyroscope-io/pyroscope/pkg/structs/cappedarr"
     5  )
     6  
     7  func (t *Tree) minValue(maxNodes int) uint64 {
     8  	if maxNodes == -1 {
     9  		return 0
    10  	}
    11  	c := cappedarr.New(maxNodes)
    12  	t.iterateWithTotal(func(total uint64) bool {
    13  		return c.Push(total)
    14  	})
    15  	return c.MinValue()
    16  }