pprof
pprof copied to clipboard
pprof disasm is not work right after go 1.16
Please answer these questions before submitting your issue. Thanks!
What version of pprof are you using?
yangjie05-mac:awesomeProject35 jie.yang05$ go version
go version go1.17.4 darwin/arm64
What system os and processor architecture are you using?
macos
yangjie05-mac:awesomeProject35 jie.yang05$ arch
arm64
What did you do?
I run my code and want to get disasm from the cpuprofile.
code:
package main
import (
"math/rand"
"os"
"runtime/pprof"
"time"
)
var global int
func main() {
f, _ := os.Create("cpu.pprof")
pprof.StartCPUProfile(f)
t := time.After(3 * time.Second)
loop:
for {
select {
case <-t:
break loop
default:
global = rand.Int()
}
}
pprof.StopCPUProfile()
f.Sync()
f.Close()
}
script:
go build -o=bin main.go
./bin
go tool pprof bin cpu.pprof
disasm rand
What did you expect to see?
expect to see (which i run in my macos with same code but go version 1.16)
(pprof) disasm rand
Total: 2.67s
ROUTINE ======================== math/rand.(*lockedSource).Int63
450ms 450ms (flat, cum) 16.85% of Total
220ms 220ms 106ce80: MOVQ GS:0x30, CX ;math/rand.(*lockedSource).Int63 rand.go:387
. . 106ce89: CMPQ 0x10(CX), SP ;rand.go:387
. . 106ce8d: JBE 0x106cf90
. . 106ce93: SUBQ $0x20, SP
. . 106ce97: MOVQ BP, 0x18(SP)
. . 106ce9c: LEAQ 0x18(SP), BP
. . 106cea1: XORL AX, AX ;rand.go:388
. . 106cea3: MOVQ 0x28(SP), DX
. . 106cea8: MOVL $0x1, BX
. . 106cead: LOCK CMPXCHGL BX, 0(DX)
60ms 60ms 106ceb1: SETE BL ;math/rand.(*lockedSource).Int63 rand.go:388
What did you see instead?
nothing but total
(pprof) disasm rand
Total: 2.63s
(pprof)
Also https://github.com/golang/go/issues/50891