MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / trendStats

Function trendStats

tests/loadtest/tools/queue_benchmark.go:562–587  ·  view source on GitHub ↗
(values []float64)

Source from the content-addressed store, hash-verified

560}
561
562func trendStats(values []float64) map[string]interface{} {
563 if len(values) == 0 {
564 return map[string]interface{}{
565 "avg": 0.0,
566 "min": 0.0,
567 "med": 0.0,
568 "max": 0.0,
569 "p(90)": 0.0,
570 "p(95)": 0.0,
571 "p(99)": 0.0,
572 }
573 }
574
575 sorted := append([]float64(nil), values...)
576 sort.Float64s(sorted)
577
578 return map[string]interface{}{
579 "avg": average(sorted),
580 "min": sorted[0],
581 "med": percentile(sorted, 50),
582 "max": sorted[len(sorted)-1],
583 "p(90)": percentile(sorted, 90),
584 "p(95)": percentile(sorted, 95),
585 "p(99)": percentile(sorted, 99),
586 }
587}
588
589func singleValueTrend(value float64) map[string]interface{} {
590 return map[string]interface{}{

Callers 1

buildSummaryFunction · 0.85

Calls 2

averageFunction · 0.85
percentileFunction · 0.70

Tested by

no test coverage detected