This topic has been already discussed here last year, but I would like to bring it up again, because some details in Go 1.11 could be changed (compared with Go 1.8). The problem is CPU profiling of Go application that actively uses C / C++ libraries via CGO interface. Pprof can't determine which C/C++ function utilizes CPU.
I put this line into one of the application subpackages (should I do it in every package that makes use of CGO functions, or even in main.go?):
import (
_ "github.com/ianlancetaylor/cgosymbolizer"
But this resulted only in a big leaf <unknown> right after that runtime.cgocall.
Could any one please actualize the state of CGO profiling?
Some environment details:
➜ ~ go version
go version go1.11 linux/amd64
➜ ~ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/isaev/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/isaev/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build600138617=/tmp/go-build -gno-record-gcc-switches"
Sincerely,
Vitaly