diff options
| author | Michael Pratt <mpratt@google.com> | 2023-12-06 14:20:49 -0500 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-01-31 23:21:53 +0000 |
| commit | 2f6a25f4478905db5e169019bf9dc39ab2a50f89 (patch) | |
| tree | 08ead6e237754b8e6d836c9480e9790099fc31a9 /src/runtime | |
| parent | e069587c8d530ec912614d138bbf59a1d1788fb9 (diff) | |
| download | go-2f6a25f4478905db5e169019bf9dc39ab2a50f89.tar.xz | |
internal/profile: remove legacy profile support
internal/profile.Parse is only used in two places: cmd/compile for
parsing PGO profiles, and net/http/pprof for parsing runtime/pprof
profiles for delta profiles. Neither case ever encounters legacy
profiles, so we can remove support entirely from the package.
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: Ic5f85b3fc1e1367131b6039dac9378913cbf9f2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/548035
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/pprof/proto_test.go | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/runtime/pprof/proto_test.go b/src/runtime/pprof/proto_test.go index 85cd066946..caaaa45f12 100644 --- a/src/runtime/pprof/proto_test.go +++ b/src/runtime/pprof/proto_test.go @@ -86,21 +86,28 @@ func testPCs(t *testing.T) (addr1, addr2 uint64, map1, map2 *profile.Mapping) { if err != nil { t.Fatal(err) } - mprof := &profile.Profile{} - if err = mprof.ParseMemoryMap(bytes.NewReader(mmap)); err != nil { - t.Fatalf("parsing /proc/self/maps: %v", err) - } - if len(mprof.Mapping) < 2 { + var mappings []*profile.Mapping + id := uint64(1) + parseProcSelfMaps(mmap, func(lo, hi, offset uint64, file, buildID string) { + mappings = append(mappings, &profile.Mapping{ + ID: id, + Start: lo, + Limit: hi, + Offset: offset, + File: file, + BuildID: buildID, + }) + id++ + }) + if len(mappings) < 2 { // It is possible for a binary to only have 1 executable // region of memory. - t.Skipf("need 2 or more mappings, got %v", len(mprof.Mapping)) + t.Skipf("need 2 or more mappings, got %v", len(mappings)) } - addr1 = mprof.Mapping[0].Start - map1 = mprof.Mapping[0] - map1.BuildID, _ = elfBuildID(map1.File) - addr2 = mprof.Mapping[1].Start - map2 = mprof.Mapping[1] - map2.BuildID, _ = elfBuildID(map2.File) + addr1 = mappings[0].Start + map1 = mappings[0] + addr2 = mappings[1].Start + map2 = mappings[1] case "windows", "darwin", "ios": addr1 = uint64(abi.FuncPCABIInternal(f1)) addr2 = uint64(abi.FuncPCABIInternal(f2)) |
