(values []float64)
| 560 | } |
| 561 | |
| 562 | func 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 | |
| 589 | func singleValueTrend(value float64) map[string]interface{} { |
| 590 | return map[string]interface{}{ |
no test coverage detected