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

Function functionCompleter

internal/driver/interactive.go:400–414  ·  view source on GitHub ↗

functionCompleter replaces provided substring with a function name retrieved from a profile if a single match exists. Otherwise, it returns unchanged substring. It defaults to no-op if the profile is not specified.

(substring string, fns []string)

Source from the content-addressed store, hash-verified

398// it returns unchanged substring. It defaults to no-op if the profile
399// is not specified.
400func functionCompleter(substring string, fns []string) string {
401 found := ""
402 for _, fName := range fns {
403 if strings.Contains(fName, substring) {
404 if found != "" {
405 return substring
406 }
407 found = fName
408 }
409 }
410 if found != "" {
411 return found
412 }
413 return substring
414}
415
416func functionNames(p *profile.Profile) []string {
417 var fns []string

Callers 1

newCompleterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…