MCPcopy Create free account
hub / github.com/google/pprof / tagGroupLabel

Method tagGroupLabel

internal/graph/dotgraph.go:439–471  ·  view source on GitHub ↗
(g []*Tag)

Source from the content-addressed store, hash-verified

437}
438
439func (b *builder) tagGroupLabel(g []*Tag) (label string, flat, cum int64) {
440 if len(g) == 1 {
441 t := g[0]
442 return measurement.Label(t.Value, t.Unit), t.FlatValue(), t.CumValue()
443 }
444 min := g[0]
445 max := g[0]
446 df, f := min.FlatDiv, min.Flat
447 dc, c := min.CumDiv, min.Cum
448 for _, t := range g[1:] {
449 if v, _ := measurement.Scale(t.Value, t.Unit, min.Unit); int64(v) < min.Value {
450 min = t
451 }
452 if v, _ := measurement.Scale(t.Value, t.Unit, max.Unit); int64(v) > max.Value {
453 max = t
454 }
455 f += t.Flat
456 df += t.FlatDiv
457 c += t.Cum
458 dc += t.CumDiv
459 }
460 if df != 0 {
461 f = f / df
462 }
463 if dc != 0 {
464 c = c / dc
465 }
466
467 // Tags are not scaled with the selected output unit because tags are often
468 // much smaller than other values which appear, so the range of tag sizes
469 // sometimes would appear to be "0..0" when scaled to the selected output unit.
470 return measurement.Label(min.Value, min.Unit) + ".." + measurement.Label(max.Value, max.Unit), f, c
471}
472
473func min64(a, b int64) int64 {
474 if a < b {

Callers 1

collapsedTagsMethod · 0.95

Calls 4

LabelFunction · 0.92
ScaleFunction · 0.92
FlatValueMethod · 0.45
CumValueMethod · 0.45

Tested by

no test coverage detected