Skip to content

Commit

Permalink
feat: data/histogram: add HistogramSets.BinValue()
Browse files Browse the repository at this point in the history
  • Loading branch information
grokify committed Sep 2, 2024
1 parent 7292570 commit 4757ed5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions data/histogram/histogram_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ func (hsets *HistogramSets) BinNames() []string {
return maputil.Keys(binNamesMap)
}

// BinValue the value of a bin.
func (hsets *HistogramSets) BinValue(hsetName, histName, binName string) int {
if hset, ok := hsets.HistogramSetMap[hsetName]; !ok || hset == nil {
return 0
} else {
return hset.BinValue(histName, binName)
}
}

func (hsets *HistogramSets) Sum() int {
sum := 0
for _, hset := range hsets.HistogramSetMap {
Expand Down

0 comments on commit 4757ed5

Please sign in to comment.