]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.20] cmd/compile/internal/pgo: fix hard-coded PGO sample data...
authorFrederic Branczyk <fbranczyk@gmail.com>
Wed, 8 Feb 2023 17:59:27 +0000 (17:59 +0000)
committerDavid Chase <drchase@google.com>
Fri, 10 Feb 2023 19:24:45 +0000 (19:24 +0000)
commit3a04b6e12ef0e5a0c608f82051943408bd6f28bd
treeb43e5304dd123ca4ac79463f3a83ac0e18b38e98
parent00f5d3001a7e684263307ab39c64eba3c79f279c
[release-branch.go1.20] cmd/compile/internal/pgo: fix hard-coded PGO sample data position

This patch detects at which index position profiling samples that have
the value-type samples count are, instead of the previously hard-coded
position of index 1. Runtime generated profiles always generate CPU
profiling data with the 0 index being CPU nanoseconds, and samples count
at index 1, which is why this previously hasn't come up.

This is a redo of CL 465135, now allowing empty profiles. Note that
preprocessProfileGraph will already cause pgo.New to return nil for
empty profiles.

For #58292
For #58309

Change-Id: Ia6c94f0793f6ca9b0882b5e2c4d34f38e600c1e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/467375
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/cmd/compile/internal/pgo/irgraph.go
src/cmd/compile/internal/test/pgo_inl_test.go