c2ede92a0d
Pprof's converter from legacy text format to protobuf format assumes that if the alloc and inuse stats are equal, then what's really going on is that the program makes no distinction, and it reads them as a two-column profile: objects and bytes. Most of the time, some sampled object has been freed, and alloc != inuse. In that case, pprof reads the profile as a four-column profile, with alloc_objects, alloc_bytes, inuse_objects, inuse_bytes. The 2-column form causes problems in a few ways. One is that if you are reading the proto form and expect samples with the 4-column names, they're not there. Another is that pprof's profile merger insists on having the same number of columns and same names. This means that pprof *.memprofile works most of the time but fails if one of the memory profiles hit the unlikely condition that alloc == inuse, since now its converted form differs from the others. Most programs should simply not be using this output form at all, but cmd/compile and cmd/link still do, because x/tools/cmd/compilebench reads some extra values from the text form that we have not yet added to the proto form. For the programs still writing this form, the easiest way to avoid the column collapse issues is to ensure that the header never reports alloc == inuse. The actual values in the header are ignored by pprof now, except for the equality check (they should sum to the other values in the file, so they are technically redundant). Because the actual values are not used except for the equality check, we could hard-code different values like 0 and 1, but just in case, to break as little as possible, this CL only adjusts the values when they would otherwise be equal. In that case it adds 1 to allocBytes. For most profiles, where alloc != inuse already, there is no effect at all. Change-Id: Ia563e402573d0f6eb81ae496645db27c08f9fe31 Reviewed-on: https://go-review.googlesource.com/c/go/+/432758 Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
codereview.cfg | ||
CONTRIBUTING.md | ||
LICENSE | ||
PATENTS | ||
README.md | ||
SECURITY.md |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.