]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/pgo: count only the last two frames as a call edge
authorCherry Mui <cherryyz@google.com>
Tue, 15 Nov 2022 18:37:42 +0000 (13:37 -0500)
committerCherry Mui <cherryyz@google.com>
Thu, 17 Nov 2022 20:52:28 +0000 (20:52 +0000)
commit6e0e492e1229b22acdc8161efd12500a0e09e67e
tree4cef5dd3596e09c16c152c750bd70bd40cdd5b82
parent3f1bcc58b32dbbf7f27fbe0984b95036ddb249b9
cmd/compile/internal/pgo: count only the last two frames as a call edge

Currently for every CPU profile sample, we apply its weight to all
call edges of the entire call stack. Frames higher up the stack
are unlikely to be repeated calls (e.g. runtime.main calling
main.main). So adding weights to call edges higher up the stack
may be not reflecting the actual call edge weights in the program.
This CL changes it to add weights to only the edge between the
last two frames.

Without a branch profile (e.g. LBR records) this is not perfect,
but seems more reasonable.

Change-Id: I0aee75cc608a152adad41c51120b661a6c542283
Reviewed-on: https://go-review.googlesource.com/c/go/+/450915
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/cmd/compile/internal/pgo/graph.go