Profiling CGO application

212 views
Skip to first unread message

Vitaly Isaev

unread,
Oct 9, 2018, 2:57:56 PM10/9/18
to golang-nuts

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?):


)


But this resulted only in a big leaf <unknown> right after that runtime.cgocall. 



Screenshot from 2018-10-09 21-30-21.png


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



Ian Lance Taylor

unread,
Oct 9, 2018, 8:20:59 PM10/9/18
to Vitaly Isaev, golang-nuts
On Tue, Oct 9, 2018 at 11:57 AM, Vitaly Isaev <vitaly...@gmail.com> wrote:
>
> 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.

It's unsupported, but see if it helps to blank import
github.com/ianlancetaylor/cgosymbolizer .

Ian
Reply all
Reply to author
Forward
0 new messages