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

Function combineProfiles

internal/driver/fetch.go:244–275  ·  view source on GitHub ↗
(profiles []*profile.Profile, msrcs []plugin.MappingSources)

Source from the content-addressed store, hash-verified

242}
243
244func combineProfiles(profiles []*profile.Profile, msrcs []plugin.MappingSources) (*profile.Profile, plugin.MappingSources, error) {
245 // Merge profiles.
246 //
247 // The merge call below only treats exactly matching sample type lists as
248 // compatible and will fail otherwise. Make the profiles' sample types
249 // compatible for the merge, see CompatibilizeSampleTypes() doc for details.
250 if err := profile.CompatibilizeSampleTypes(profiles); err != nil {
251 return nil, nil, err
252 }
253 if err := measurement.ScaleProfiles(profiles); err != nil {
254 return nil, nil, err
255 }
256
257 // Avoid expensive work for the common case of a single profile/src.
258 if len(profiles) == 1 && len(msrcs) == 1 {
259 return profiles[0], msrcs[0], nil
260 }
261
262 p, err := profile.Merge(profiles)
263 if err != nil {
264 return nil, nil, err
265 }
266
267 // Combine mapping sources.
268 msrc := make(plugin.MappingSources)
269 for _, ms := range msrcs {
270 for m, s := range ms {
271 msrc[m] = append(msrc[m], s...)
272 }
273 }
274 return p, msrc, nil
275}
276
277type profileSource struct {
278 addr string

Callers 3

fetchProfilesFunction · 0.85
chunkedGrabFunction · 0.85
concurrentGrabFunction · 0.85

Calls 3

CompatibilizeSampleTypesFunction · 0.92
ScaleProfilesFunction · 0.92
MergeFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…