Running go tool pprof
with a cpu profile for https://github.com/vimeo/statsdaemon and typing "web" I get an svg profile with extensive use of "runtime.futex". But I can't see where it's coming from, it just says "System".
I want to know which code my program invokes, that causes so much time spent in runtime.futex
.
To be sure I passed '-nodefraction=0'
which makes it not drop nodes in the web svg view, though it says "showing top 80 nodes out of 246 (cum >= 0.11s)", maybe this is related.
I tried https://code.google.com/p/gperftools/ and it shows the same. The viz drops no nodes or edges, but still "runtime.futex" just shows up under "System" and that's the root node?
A futex or "Fast user space mutex" is a linux system call that is used for basic locking. I imagine the go runtime uses it quite a bit under the hood.
Without seeing some of the code it's hard to say for sure but for highly concurrent code with a lot of coordination using channels it's possible that the futex calls really are coming from System and no particular function.
When I've faced with such issue I've used runtime/trace
where I've see that some function was called very often and this function creates new ticker by
ticker := time.NewTicker()
but does not stop it by
defer ticker.Stop()
Also, don't forget to stop timers as well:
timer := time.NewTimer(duration)
defer timer.Stop()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With