code: func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, address bool) error {
  	for _, m := range p.Mapping {
  		m.HasInlineFrames = m.HasInlineFrames && inlineFrame
  		m.HasFunctions = m.HasFunctions && function
  		m.HasFilenames = m.HasFilenames && filename
  		m.HasLineNumbers = m.HasLineNumbers && linenumber
  	}
  
  	// Aggregate functions
  	if !function || !filename {
  		for _, f := range p.Function {
  			if !function {
  				f.Name = ""
  				f.SystemName = ""
  			}
  			if !filename {
  				f.Filename = ""
  			}
  		}
  	}
  
  	// Aggregate locations
  	if !inlineFrame || !address || !linenumber {
  		for _, l := range p.Location {
  			if !inlineFrame && len(l.Line) > 1 {
  				l.Line = l.Line[len(l.Line)-1:]
  			}
  			if !linenumber {
  				for i := range l.Line {
  					l.Line[i].Line = 0
  				}
  			}
  			if !address {
  				l.Address = 0
  			}
  		}
  	}
  
  	return p.CheckValid()
  }
docs: // 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.