AvgRate returns the average of all the message rates in the SampleGroup
()
| 215 | |
| 216 | // AvgRate returns the average of all the message rates in the SampleGroup |
| 217 | func (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 |
| 229 | func (sg *SampleGroup) StdDev() float64 { |