[Bug go/70787] New: No time and child info with -pg and gccgo
vogt at linux dot vnet.ibm.com
gcc-bugzilla@gcc.gnu.org
Mon Apr 25 13:44:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70787
Bug ID: 70787
Summary: No time and child info with -pg and gccgo
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: go
Assignee: ian at airs dot com
Reporter: vogt at linux dot vnet.ibm.com
CC: cmang at google dot com, krebbel at gcc dot gnu.org
Target Milestone: ---
It looks like the -pg option does something wrong for Go programs. Example:
This program just wastes time in sub functions:
-- main.go --
package main
func foo () {
var i int
i = 0
for (i < 1000) { i++ }
}
func bar () {
var i int
i = 0
for (i < 1000) { i++ }
}
func main () {
var i int
i = 0
for (i < 1000000) { foo(); foo(); bar(); i++ }
}
-- snip --
$ gccgo -pg -O0 main.go
$ ./a.out
$ prof ./a.out gmoun.out
=>
index % time self children called name
0.00 0.00 3000000/3000000 main.main [8]
[1] 0.0 0.00 0.00 3000000 frame_dummy [1]
^^^ ^^^^ ^^^^
(actual run time was about 5 seconds)
Even for this very simple program without Go library dependencies, no timing
information seems to be dumped into the gmon.out file. Function calls have all
been counted in the "frame_dummy" bucket (double checked that functios have not
been inlied).
My vague first guess is that maybe the timing information is written to to some
place in memory but is read from a different place when generating gmon.out
because the profiling code is not aware of Gccgo's threading model(?).
More information about the Gcc-bugs
mailing list