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

Function collectMappingSources

internal/driver/fetch.go:363–388  ·  view source on GitHub ↗

collectMappingSources saves the mapping sources of a profile.

(p *profile.Profile, source string)

Source from the content-addressed store, hash-verified

361
362// collectMappingSources saves the mapping sources of a profile.
363func collectMappingSources(p *profile.Profile, source string) plugin.MappingSources {
364 ms := plugin.MappingSources{}
365 for _, m := range p.Mapping {
366 src := struct {
367 Source string
368 Start uint64
369 }{
370 source, m.Start,
371 }
372 key := m.BuildID
373 if key == "" {
374 key = m.File
375 }
376 if key == "" {
377 // If there is no build id or source file, use the source as the
378 // mapping file. This will enable remote symbolization for this
379 // mapping, in particular for Go profiles on the legacy format.
380 // The source is reset back to empty string by unsourceMapping
381 // which is called after symbolization is finished.
382 m.File = source
383 key = source
384 }
385 ms[key] = append(ms[key], src)
386 }
387 return ms
388}
389
390// unsourceMappings iterates over the mappings in a profile and replaces file
391// set to the remote source URL by collectMappingSources back to empty string.

Callers 2

grabProfileFunction · 0.85

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…