cmd/pprof: pprof provides wrong address/line for CPU profiles #41338
Labels
Documentation
Issues describing a change to documentation.
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
Using CPU profiling and
go tool pprof
attributes CPU to the instruction following the one that consumed the time. This can cause CPU time to be attributed to an incorrect line number. For comparison, the Linuxperf
command works correctly. The example below shows the time is spent in thefor
loop, when it is actually spent during expensive memory accesses.AFAICT this issue has existed for a long time (at least since 1.4). I can't see this issue has been logged yet which is surprising. It occurs with recent toolchains as well:
Tested on:
Linux localhost.localdomain 5.8.4-200.fc32.x86_64 #1 SMP Wed Aug 26 22:28:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Here is a script which demonstrates the fault:
And the output:
Cc @hyangah @randall77
The text was updated successfully, but these errors were encountered: