diff options
| author | Cherry Mui <cherryyz@google.com> | 2022-11-22 12:39:05 -0500 |
|---|---|---|
| committer | Cherry Mui <cherryyz@google.com> | 2022-11-22 18:58:12 +0000 |
| commit | bb917bd1b212dc8fff3852fa164667cd06b9f653 (patch) | |
| tree | 36785e58dd168eca8d7001b48dbbed10bdadfe91 /src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go | |
| parent | 21015cf6baed45a1e7c3d1a0dfe34c778140344f (diff) | |
| download | go-bb917bd1b212dc8fff3852fa164667cd06b9f653.tar.xz | |
cmd/vendor: update vendored github.com/google/pprof for Go 1.20 release
The Go 1.20 code freeze has recently started. This is a time to
update the vendored copy.
Done by
cd GOROOT/src/cmd
go get -d github.com/google/pprof@latest
go mod tidy
go mod vendor
For #36905.
Change-Id: Iaec604c66ea8f4b7638a31bdb77d6dd56966e38a
Reviewed-on: https://go-review.googlesource.com/c/go/+/452815
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@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 | 25 |
1 files changed, 22 insertions, 3 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 6a1e64c600..27681c540f 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 @@ -59,9 +59,8 @@ func PProf(eo *plugin.Options) error { return interactive(p, o) } +// generateRawReport is allowed to modify p. func generateRawReport(p *profile.Profile, cmd []string, cfg config, o *plugin.Options) (*command, *report.Report, error) { - p = p.Copy() // Prevent modification to the incoming profile. - // Identify units of numeric tags in profile. numLabelUnits := identifyNumLabelUnits(p, o.UI) @@ -110,6 +109,7 @@ func generateRawReport(p *profile.Profile, cmd []string, cfg config, o *plugin.O return c, rpt, nil } +// generateReport is allowed to modify p. func generateReport(p *profile.Profile, cmd []string, cfg config, o *plugin.Options) error { c, rpt, err := generateRawReport(p, cmd, cfg, o) if err != nil { @@ -201,7 +201,6 @@ func applyCommandOverrides(cmd string, outputFormat int, cfg config) config { case report.Proto, report.Raw, report.Callgrind: trim = false cfg.Granularity = "addresses" - cfg.NoInlines = false } if !trim { @@ -365,3 +364,23 @@ func valueExtractor(ix int) sampleValueFunc { return v[ix] } } + +// profileCopier can be used to obtain a fresh copy of a profile. +// It is useful since reporting code may mutate the profile handed to it. +type profileCopier []byte + +func makeProfileCopier(src *profile.Profile) profileCopier { + // Pre-serialize the profile. We will deserialize every time a fresh copy is needed. + var buf bytes.Buffer + src.WriteUncompressed(&buf) + return profileCopier(buf.Bytes()) +} + +// newCopy returns a new copy of the profile. +func (c profileCopier) newCopy() *profile.Profile { + p, err := profile.ParseUncompressed([]byte(c)) + if err != nil { + panic(err) + } + return p +} |
