diff options
| author | Mark Hansen <markhansen@google.com> | 2021-10-08 03:53:09 +0000 |
|---|---|---|
| committer | Alexander Rakoczy <alex@golang.org> | 2021-10-13 15:38:39 +0000 |
| commit | b8e4df01dd1aa61b3de978e4874c81b0d23349d5 (patch) | |
| tree | 71f62d2cad771be39a94a03eefa2408f0356e216 /src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go | |
| parent | f687831e4cfa06d19533d47ae93c0451bd1ca688 (diff) | |
| download | go-b8e4df01dd1aa61b3de978e4874c81b0d23349d5.tar.xz | |
cmd/pprof: update vendored github.com/google/pprof
Pull in the latest published version of github.com/google/pprof
This adds the tagroot and tagleaf options from
https://github.com/google/pprof/commit/7fe48b4c820be13151ae35ce5a5e3f54f1b53eef
Done with:
go get -d github.com/google/pprof@latest
go mod tidy
go mod vendor
Fixes #48839
Change-Id: I85bf0e0689310014eb198c8d5e0bb3a86b0aef1c
GitHub-Last-Rev: b26260f30514eb71be76c9b2f74f9d3aace205b9
GitHub-Pull-Request: golang/go#48856
Reviewed-on: https://go-review.googlesource.com/c/go/+/354692
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Alexander Rakoczy <alex@golang.org>
Diffstat (limited to 'src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go')
| -rw-r--r-- | src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go index 3967a12d45..6a1e64c600 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go @@ -73,6 +73,10 @@ func generateRawReport(p *profile.Profile, cmd []string, cfg config, o *plugin.O cfg = applyCommandOverrides(cmd[0], c.format, cfg) + // Create label pseudo nodes before filtering, in case the filters use + // the generated nodes. + generateTagRootsLeaves(p, cfg, o.UI) + // Delay focus after configuring report to get percentages on all samples. relative := cfg.RelativePercentages if relative { @@ -208,6 +212,25 @@ func applyCommandOverrides(cmd string, outputFormat int, cfg config) config { return cfg } +// generateTagRootsLeaves generates extra nodes from the tagroot and tagleaf options. +func generateTagRootsLeaves(prof *profile.Profile, cfg config, ui plugin.UI) { + tagRootLabelKeys := dropEmptyStrings(strings.Split(cfg.TagRoot, ",")) + tagLeafLabelKeys := dropEmptyStrings(strings.Split(cfg.TagLeaf, ",")) + rootm, leafm := addLabelNodes(prof, tagRootLabelKeys, tagLeafLabelKeys, cfg.Unit) + warnNoMatches(cfg.TagRoot == "" || rootm, "TagRoot", ui) + warnNoMatches(cfg.TagLeaf == "" || leafm, "TagLeaf", ui) +} + +// dropEmptyStrings filters a slice to only non-empty strings +func dropEmptyStrings(in []string) (out []string) { + for _, s := range in { + if s != "" { + out = append(out, s) + } + } + return +} + func aggregate(prof *profile.Profile, cfg config) error { var function, filename, linenumber, address bool inlines := !cfg.NoInlines |
