MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / Update

Method Update

dgraph/cmd/debug/run.go:721–744  ·  view source on GitHub ↗

Update changes the Min and Max fields if value is less than or greater than the current values.

(value int64)

Source from the content-addressed store, hash-verified

719
720// Update changes the Min and Max fields if value is less than or greater than the current values.
721func (histogram *HistogramData) Update(value int64) {
722 if value > histogram.Max {
723 histogram.Max = value
724 }
725 if value < histogram.Min {
726 histogram.Min = value
727 }
728
729 histogram.Sum += value
730 histogram.Count++
731
732 for index := 0; index <= len(histogram.Bounds); index++ {
733 // Allocate value in the last buckets if we reached the end of the Bounds array.
734 if index == len(histogram.Bounds) {
735 histogram.CountPerBucket[index]++
736 break
737 }
738
739 if value < int64(histogram.Bounds[index]) {
740 histogram.CountPerBucket[index]++
741 break
742 }
743 }
744}
745
746// PrintHistogram prints the histogram data in a human-readable format.
747func (histogram *HistogramData) PrintHistogram() {

Callers 4

bufferStatsFunction · 0.95
reduceMethod · 0.95
sizeHistogramFunction · 0.95
waitMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected