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

Function stackCollapse

internal/driver/tagroot_test.go:372–385  ·  view source on GitHub ↗

stackCollapse returns a slice of strings where each string represents one profile sample in Brendan Gregg's "Folded Stacks" format: " (filename); (filename); (filename) ". This allows the expected values for test cases to be specified in human-readable strings.

(p *profile.Profile)

Source from the content-addressed store, hash-verified

370// allows the expected values for test cases to be specified in human-readable
371// strings.
372func stackCollapse(p *profile.Profile) []string {
373 var ret []string
374 for _, s := range p.Sample {
375 var funcs []string
376 for i := range s.Location {
377 loc := s.Location[len(s.Location)-1-i]
378 for _, line := range loc.Line {
379 funcs = append(funcs, fmt.Sprintf("%s(%s)", line.Function.Name, line.Function.Filename))
380 }
381 }
382 ret = append(ret, fmt.Sprintf("%s %d", strings.Join(funcs, ";"), s.Value[0]))
383 }
384 return ret
385}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…