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

Method Aggregate

profile/profile.go:443–488  ·  view source on GitHub ↗

Aggregate merges the locations in the profile into equivalence classes preserving the request attributes. It also updates the samples to point to the merged locations.

(inlineFrame, function, filename, linenumber, columnnumber, address bool)

Source from the content-addressed store, hash-verified

441// classes preserving the request attributes. It also updates the
442// samples to point to the merged locations.
443func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, columnnumber, address bool) error {
444 for _, m := range p.Mapping {
445 m.HasInlineFrames = m.HasInlineFrames && inlineFrame
446 m.HasFunctions = m.HasFunctions && function
447 m.HasFilenames = m.HasFilenames && filename
448 m.HasLineNumbers = m.HasLineNumbers && linenumber
449 }
450
451 // Aggregate functions
452 if !function || !filename {
453 for _, f := range p.Function {
454 if !function {
455 f.Name = ""
456 f.SystemName = ""
457 }
458 if !filename {
459 f.Filename = ""
460 }
461 }
462 }
463
464 // Aggregate locations
465 if !inlineFrame || !address || !linenumber || !columnnumber {
466 for _, l := range p.Location {
467 if !inlineFrame && len(l.Line) > 1 {
468 l.Line = l.Line[len(l.Line)-1:]
469 }
470 if !linenumber {
471 for i := range l.Line {
472 l.Line[i].Line = 0
473 l.Line[i].Column = 0
474 }
475 }
476 if !columnnumber {
477 for i := range l.Line {
478 l.Line[i].Column = 0
479 }
480 }
481 if !address {
482 l.Address = 0
483 }
484 }
485 }
486
487 return p.CheckValid()
488}
489
490// NumLabelUnits returns a map of numeric label keys to the units
491// associated with those keys and a map of those keys to any units

Callers 6

javaCPUProfileFunction · 0.95
parseJavaProfileFunction · 0.95
TestAggregationFunction · 0.80
TestMergeFunction · 0.80
TestEmptyMappingMergeFunction · 0.80
aggregateFunction · 0.80

Calls 1

CheckValidMethod · 0.95

Tested by 3

TestAggregationFunction · 0.64
TestMergeFunction · 0.64
TestEmptyMappingMergeFunction · 0.64