(baseline, candidate BenchmarkRun)
| 93 | } |
| 94 | |
| 95 | func (BenchmarkCore) ComputeDeltas(baseline, candidate BenchmarkRun) BenchmarkComparison { |
| 96 | var deltaRecords []MetricDelta |
| 97 | metricDeltas := map[string]map[string]any{} |
| 98 | for _, pluginName := range runPluginNames(candidate) { |
| 99 | candidateResult := candidate.PluginResults[pluginName] |
| 100 | baselineResult, ok := baseline.PluginResults[pluginName] |
| 101 | if !ok { |
| 102 | continue |
| 103 | } |
| 104 | candidateMetrics := candidateResult.Scorecard.MetricMap() |
| 105 | baselineMetrics := baselineResult.Scorecard.MetricMap() |
| 106 | pluginDeltas := map[string]any{} |
| 107 | for _, metricName := range sortedMetricNames(candidateMetrics) { |
| 108 | candidateValue := candidateMetrics[metricName] |
| 109 | baselineValue := baselineMetrics[metricName] |
| 110 | deltaValue := deltaValue(baselineValue, candidateValue) |
| 111 | if deltaValue != nil { |
| 112 | pluginDeltas[metricName+"_delta"] = *deltaValue |
| 113 | } |
| 114 | deltaRecords = append(deltaRecords, MetricDelta{ |
| 115 | Plugin: pluginName, |
| 116 | MetricName: metricName, |
| 117 | BaselineValue: baselineValue, |
| 118 | CandidateValue: candidateValue, |
| 119 | Delta: deltaValue, |
| 120 | }) |
| 121 | } |
| 122 | metricDeltas[pluginName] = pluginDeltas |
| 123 | } |
| 124 | return BenchmarkComparison{ |
| 125 | Baseline: baseline, |
| 126 | Candidate: candidate, |
| 127 | MetricDeltas: metricDeltas, |
| 128 | DeltaRecords: deltaRecords, |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | func (BenchmarkCore) RunSuite(ctx context.Context, plugin BenchmarkPlugin, variant *VariantOverride) (PluginRunResult, error) { |
| 133 | return plugin.RunSuite(ctx, variant) |
nothing calls this directly
no test coverage detected