()
| 237 | } |
| 238 | |
| 239 | func (u *NylonEndpoint) calcR() (time.Duration, time.Duration, time.Duration) { |
| 240 | u.Lock() |
| 241 | defer u.Unlock() |
| 242 | if len(u.history) < u.t.MinimumConfidenceWindow { |
| 243 | return time.Second * 1, time.Second * 1, time.Second * 1 |
| 244 | } |
| 245 | if u.dirty { |
| 246 | u.histSort = slices.Clone(u.history) |
| 247 | slices.Sort(u.histSort) |
| 248 | u.dirty = false |
| 249 | } |
| 250 | le := len(u.histSort) |
| 251 | low := u.histSort[int(float64(le)*u.t.OutlierPercentage)] |
| 252 | high := u.histSort[int(float64(le)*(1-u.t.OutlierPercentage))] |
| 253 | med := u.histSort[le/2] |
| 254 | return low, med, high |
| 255 | } |
| 256 | |
| 257 | func (u *NylonEndpoint) LowRange() time.Duration { |
| 258 | l, _, _ := u.calcR() |
no test coverage detected