MCPcopy
hub / github.com/nats-io/nats.go / AvgRate

Method AvgRate

bench/bench.go:217–226  ·  view source on GitHub ↗

AvgRate returns the average of all the message rates in the SampleGroup

()

Source from the content-addressed store, hash-verified

215
216// AvgRate returns the average of all the message rates in the SampleGroup
217func (sg *SampleGroup) AvgRate() int64 {
218 if !sg.HasSamples() {
219 return 0
220 }
221 sum := uint64(0)
222 for _, s := range sg.Samples {
223 sum += uint64(s.Rate())
224 }
225 return int64(sum / uint64(len(sg.Samples)))
226}
227
228// StdDev returns the standard deviation the message rates in the SampleGroup
229func (sg *SampleGroup) StdDev() float64 {

Callers 3

TestAvgRateFunction · 0.95
StatisticsMethod · 0.95
StdDevMethod · 0.95

Calls 2

HasSamplesMethod · 0.95
RateMethod · 0.80

Tested by 1

TestAvgRateFunction · 0.76