2 ms·
Thought it might also be helpful to add that I usually invoke perf like this: perf record --call-graph dwarf -e cycles --switch-events --sample-cpu -p $(p
by jrockway 6y ago
Thought it might also be helpful to add that I usually invoke perf like this:
perf record --call-graph dwarf -e cycles --switch-events --sample-cpu -p $(pidof my-go-process)
And then view the results in hotspot (https://github.com/KDAB/hotspot https://github.com/KDAB/hotspot).
I played a little with off-cpu profiling (-e sched:sched_switch), but Go kind of outsmarts that by doing its own scheduling (taking Goroutines off Machines when it thinks it's going to block inside a syscall, so the resulting flamegraphs are usually rooted in runtime.park_m; though if the runtime gets something wrong, you'd be able to see it here.)