Revert "cmd/compile/internal/pgo: fix hard-coded PGO sample data position"

This reverts CL 465135.

Reason for revert: This broke cmd/go.TestScript/build_pgo on the linux-amd64-longtest builder: https://build.golang.org/log/8f8ed7bf576f891a06d295c4a5bca987c6e941d6

Change-Id: Ie2f2cc2731099eb28eda6b94dded4dfc34e29441
Reviewed-on: https://go-review.googlesource.com/c/go/+/466439
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Pratt 2023-02-08 18:48:17 +00:00 committed by Gopher Robot
parent da93766043
commit bb6952fa25
2 changed files with 1 additions and 85 deletions

View file

@ -140,25 +140,9 @@ func New(profileFile string) *Profile {
return nil
}
samplesCountIndex := -1
for i, s := range profile.SampleType {
// Samples count is the raw data collected, and CPU nanoseconds is just
// a scaled version of it, so either one we can find is fine.
if (s.Type == "samples" && s.Unit == "count") ||
(s.Type == "cpu" && s.Unit == "nanoseconds") {
samplesCountIndex = i
break
}
}
if samplesCountIndex == -1 {
log.Fatal("failed to find CPU samples count or CPU nanoseconds value-types in profile.")
return nil
}
g := newGraph(profile, &Options{
CallTree: false,
SampleValue: func(v []int64) int64 { return v[samplesCountIndex] },
SampleValue: func(v []int64) int64 { return v[1] },
})
p := &Profile{