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)
| 370 | // allows the expected values for test cases to be specified in human-readable |
| 371 | // strings. |
| 372 | func 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 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…