MCPcopy
hub / github.com/cilium/cilium / calcMinMax

Function calcMinMax

tools/complexity-diff/main.go:220–244  ·  view source on GitHub ↗
(records []verifierComplexityRecord, metric func(r verifierComplexityRecord) int)

Source from the content-addressed store, hash-verified

218}
219
220func calcMinMax(records []verifierComplexityRecord, metric func(r verifierComplexityRecord) int) map[string]minMax {
221 minMaxRecords := map[string]minMax{}
222 for _, r := range records {
223 mm, ok := minMaxRecords[collectionProgramKey(r)]
224 if !ok {
225 mm = minMax{
226 min: metric(r),
227 minKey: kernelBuildLoadKey(r),
228 max: metric(r),
229 maxKey: kernelBuildLoadKey(r),
230 }
231 }
232 if metric(r) < mm.min {
233 mm.minKey = kernelBuildLoadKey(r)
234 mm.min = metric(r)
235 }
236 if metric(r) > mm.max {
237 mm.maxKey = kernelBuildLoadKey(r)
238 mm.max = metric(r)
239 }
240 minMaxRecords[collectionProgramKey(r)] = mm
241 }
242
243 return minMaxRecords
244}
245
246func minMaxKeysSortAbs(minMaxes map[string]minMax) []string {
247 keys := slices.Sorted(maps.Keys(minMaxes))

Callers 1

mainFunction · 0.85

Calls 3

collectionProgramKeyFunction · 0.85
kernelBuildLoadKeyFunction · 0.85
metricStruct · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…