A simple package for profiling deployed binaries.
Key features:
- Does not require running any other scripts/tools, only the binary under monitoring.
- Flame graphs for stack trace profiling.
- Memory, GC pauses and goroutines line charts.
-
go-torch. https://github.com/uber/go-torch. go-torch does cpu profiling and represents it as a flame graph. We were directly inspired by this package. In contrast to goprofui, go-torch requires the go pprof tool and an external Perl script.
-
profile. https://github.com/pkg/profile. profile does cpu and memory profiling, and saves them into a file. It is easy to setup and use. However, the cpu profiles would have to be further parsed for a flame graph.
-
flame graphs. http://www.brendangregg.com/flamegraphs.html. Created by Brendan Gregg. An extremely succinct way to summarize stack traces.
go get github.com/wirelessregistry/goprofui
-
Requires the net web-socket library https://godoc.org/golang.org/x/net/websocket.
-
The flame graph JS library is https://github.com/spiermar/d3-flame-graph.
-
The line chart JS library is D3's.
-
goprofui's internal package is forked from pprof's internal package. It is covered by the BSD-license in LICENSE_internal_pkg.
The quickest way to get started is to copy the handlers' setup from examples/web/web.go. Build the web.go application, and then serve the index.html file using a web server (https://github.com/indexzero/http-server for example).
When you visit the example using your web browser, you will see some graphs:
The cpu profiling code is in cpu.go. The memory, GC latency and goroutines stats are obtained in tickerHandlers.go.