On Wed, Jun 26, 2019 at 11:13 PM psu via golang-nuts <golang-nuts@googlegroups.com> wrote: > > I am wondering when and how sigprofNonGo() and sigprofNonGoPC() are invoked > during pprof CPU profiling (pprof.StartCPUProfile(...)). I had thought they > would be invoked when user C code (invoked via cgo) is being profiled? But in > my experiments, it never happened.
The two functions are only used if a SIGPROF arrives for a thread that was started by C that is running C code. So you will only see them if your C code starts new threads. For a thread that was started by Go the profiler will normally record just the Go stack trace. If you want to collect a C traceback in addition to the Go traceback you can call runtime.SetCgoTraceback (only supported on amd64 running Darwin or FreeBSD or GNU/Linux); the easiest way to do that is to import github.com/ianlancetaylor/cgosymbolizer (completely unsupported but it usually works). Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcW3DqMOsQNov9KnMPjAK4U0_wMkhcZpbJSVr8xpg3sk%2Bg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.