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

Function ShortenFunctionName

internal/graph/graph.go:466–475  ·  view source on GitHub ↗

ShortenFunctionName returns a shortened version of a function's name.

(f string)

Source from the content-addressed store, hash-verified

464
465// ShortenFunctionName returns a shortened version of a function's name.
466func ShortenFunctionName(f string) string {
467 f = cppAnonymousPrefixRegExp.ReplaceAllString(f, "")
468 f = goVerRegExp.ReplaceAllString(f, `${1}${2}`)
469 for _, re := range []*regexp.Regexp{goRegExp, javaRegExp, cppRegExp} {
470 if matches := re.FindStringSubmatch(f); len(matches) >= 2 {
471 return strings.Join(matches[1:], "")
472 }
473 }
474 return f
475}
476
477// TrimTree trims a Graph in forest form, keeping only the nodes in kept. This
478// will not work correctly if even a single node has multiple parents.

Callers 3

shortNameListFunction · 0.92
multilinePrintableNameFunction · 0.85
TestShortenFunctionNameFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestShortenFunctionNameFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…