Profiling go programs
go, profiling
Solution
It's a known bug that profiling doesn't work on Mac OS X. https://code.google.com/p/go/issues/detail?id=6047
The bug is in the Mac OS X kernel, and Russ Cox has a patch, described here: http://godoc.org/code.google.com/p/rsc/cmd/pprof_mac_fix , but that comes with dire warnings about screwing up your machine. In particular, there's known problems with the patch under Mavericks.
Problem
I try to profile my go library, but I am stuck with the following output: ``` (pprof) top10 Total: 884 samples 884 100.0% 100.0% 884 100.0% runtime.mach_semaphore_wait 0 0.0% 100.0% 884 100.0% System ``` Which is not really helpful. My library reads a zip-file and parses the enclosed XML files (xlsx). When I move the profiling functions inside the lowest part of my library (where the actual xml decoding takes place), the output is not much 'better': ``` (pprof) top10 Total: 884 samples 884 100.0% 100.0% 884 100.0% fmt.(*fmt).formatFloat 0 0.0% 100.0% 884 100.0% runtime.schedtrace ``` I know that this is a very vague question, but perhaps there are some helpful hints without having to provide the whole source code? I have taken the profiler call from the golang blog entry and call the profiler with `go tool pprof main profile` after building `main.go`. ``` f, err := os.Create("profile") if err != nil { log.Fatal(err) } pprof.StartCPUProfile(f) defer pprof.StopCPUProfile() ... my source code here ```