]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile/internal/pgo: match on call line offsets
authorMichael Pratt <mpratt@google.com>
Wed, 2 Nov 2022 15:11:03 +0000 (11:11 -0400)
committerGopher Robot <gobot@golang.org>
Fri, 4 Nov 2022 21:20:22 +0000 (21:20 +0000)
commitbdd1e283a914d4d161589adce4f2ad79767d029d
tree91745908f0a233bbf1ab20c37c634d0bb2074f55
parentf187c6b08eac9dddd161bb2e7537def3bbf8ec9a
cmd/compile/internal/pgo: match on call line offsets

Rather than matching calls to edges in the profile based directly on
line number in the source file, use the line offset from the start of
the function. This makes matching robust to changes in the source file
above the function containing the call.

The start line in the profile comes from Function.start_line, which is
included in Go pprof output since CL 438255.

Currently it is an error if no samples set start_line to help users
detect profiles missing this information. In the future, we should
fallback to using absolute lines, which is better than nothing.

For #55022.

Change-Id: Ie621950cfee1fef8fb200907a2a3f1ded41d04fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/447315
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
src/cmd/compile/internal/inline/inl.go
src/cmd/compile/internal/pgo/irgraph.go
src/cmd/compile/internal/test/pgo_inl_test.go
src/cmd/compile/internal/test/testdata/pgo/inline/inline_hot.go
src/cmd/compile/internal/test/testdata/pgo/inline/inline_hot.pprof
src/cmd/compile/internal/test/testdata/pgo/inline/inline_hot_test.go