]> Cypherpunks repositories - gostls13.git/commit
net/http/pprof: support the "seconds" param for block, mutex profiles
authorHana Kim <hyangah@gmail.com>
Wed, 11 Dec 2019 23:47:05 +0000 (18:47 -0500)
committerHyang-Ah Hana Kim <hyangah@gmail.com>
Fri, 17 Apr 2020 19:35:56 +0000 (19:35 +0000)
commit2ff1e3ebf5de77325c0e96a6c2a229656fc7be50
treebd0efb8e47988d2e2e1c09b727bb4923e1746bcd
parentef5c59d47b7f4376ea8ff54fb0a882528c0f5588
net/http/pprof: support the "seconds" param for block, mutex profiles

When the seconds param is given, the block and mutex profile endpoints
report the difference between two measurements collected the given
seconds apart. Historically, the block and mutex profiles have reported
the cumulative counts since the process start, and it turned out they
are more useful when interpreted along with the time duration.

Note: cpu profile and trace endpoints already accept the "seconds"
parameter. With this CL, the block and mutex profile endpoints will
accept the "seconds" parameter. Providing the "seconds" parameter
to other types of profiles is an error.

This change moves runtime/pprof/internal/profile to internal/profile and
adds part of merge logic from github.com/google/pprof/profile/merge.go to
internal/profile, in order to allow both net/http/pprof and runtime/pprof
to access it.

Fixes #23401

Change-Id: Ie2486f1a63eb8ff210d7d3bc2de683e9335fd5cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/147598
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
16 files changed:
src/go/build/deps_test.go
src/internal/profile/encode.go [moved from src/runtime/pprof/internal/profile/encode.go with 100% similarity]
src/internal/profile/filter.go [moved from src/runtime/pprof/internal/profile/filter.go with 100% similarity]
src/internal/profile/legacy_profile.go [moved from src/runtime/pprof/internal/profile/legacy_profile.go with 100% similarity]
src/internal/profile/merge.go [new file with mode: 0644]
src/internal/profile/profile.go [moved from src/runtime/pprof/internal/profile/profile.go with 92% similarity]
src/internal/profile/profile_test.go [moved from src/runtime/pprof/internal/profile/profile_test.go with 100% similarity]
src/internal/profile/proto.go [moved from src/runtime/pprof/internal/profile/proto.go with 100% similarity]
src/internal/profile/proto_test.go [moved from src/runtime/pprof/internal/profile/proto_test.go with 100% similarity]
src/internal/profile/prune.go [moved from src/runtime/pprof/internal/profile/prune.go with 100% similarity]
src/net/http/pprof/pprof.go
src/net/http/pprof/pprof_test.go
src/runtime/pprof/mprof_test.go
src/runtime/pprof/pprof_test.go
src/runtime/pprof/proto_test.go
src/runtime/pprof/protomem_test.go