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