]> Cypherpunks.ru repositories - gostls13.git/commit
runtime/pprof: introduce "allocs" profile
authorHana (Hyang-Ah) Kim <hyangah@gmail.com>
Tue, 27 Mar 2018 16:23:19 +0000 (12:23 -0400)
committerHyang-Ah Hana Kim <hyangah@gmail.com>
Tue, 24 Apr 2018 16:11:41 +0000 (16:11 +0000)
commitcd037bce09ec1aecd40d9c91c23d09f5b60549f4
tree932329eed8ad31e2e06750de1afe7976244a4753
parent70c5839fe0e2149d505c0e28c42e133d4bc01503
runtime/pprof: introduce "allocs" profile

The Go's heap profile contains four kinds of samples
(inuse_space, inuse_objects, alloc_space, and alloc_objects).
The pprof tool by default chooses the inuse_space (the bytes
of live, in-use objects). When analyzing the current memory
usage the choice of inuse_space as the default may be useful,
but in some cases, users are more interested in analyzing the
total allocation statistics throughout the program execution.
For example, when we analyze the memory profile from benchmark
or program test run, we are more likely interested in the whole
allocation history than the live heap snapshot at the end of
the test or benchmark.

The pprof tool provides flags to control which sample type
to be used for analysis. However, it is one of the less-known
features of pprof and we believe it's better to choose the
right type of samples as the default when producing the profile.

This CL introduces a new type of profile, "allocs", which is
the same as the "heap" profile but marks the alloc_space
as the default type unlike heap profiles that use inuse_space
as the default type.

'go test -memprofile=...' command is changed to use the new
"allocs" profile type instead of the traditional "heap" profile.

Fixes #24443

Change-Id: I012dd4b6dcacd45644d7345509936b8380b6fbd9
Reviewed-on: https://go-review.googlesource.com/102696
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/go/internal/test/test.go
src/runtime/pprof/internal/profile/encode.go
src/runtime/pprof/internal/profile/profile.go
src/runtime/pprof/pprof.go
src/runtime/pprof/proto.go
src/runtime/pprof/proto_test.go
src/runtime/pprof/protomem.go
src/runtime/pprof/protomem_test.go
src/testing/internal/testdeps/deps.go
src/testing/testing.go