MCPcopy Create free account
hub / github.com/encodeous/nylon / calcR

Method calcR

state/endpoint.go:239–255  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

237}
238
239func (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
257func (u *NylonEndpoint) LowRange() time.Duration {
258 l, _, _ := u.calcR()

Callers 3

LowRangeMethod · 0.95
HighRangeMethod · 0.95
StabilizedPingMethod · 0.95

Calls 1

CloneMethod · 0.80

Tested by

no test coverage detected