$ go get -u github.com/google/pprof
$ sudo apt install graphviz
// pprof
_ "net/http/pprof"
// mainの中に以下をいれる
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
「ベンチをまわしながら」 以下を起動する。(動いているものに、後からアタッチするということである)
$ pprof -http=localhost:8888 ~/isucari/webapp/go/isucari/ http://localhost:6060/debug/pprof/profile
Fetching profile over HTTP from http://localhost:6060/debug/pprof/profile
/home/isucon/isucari/webapp/go/isucari/: open /home/isucon/isucari/webapp/go/isucari/: not a directory
Fetched 1 source profiles out of 2
Saved profile in /home/isucon/pprof/pprof.isucari.samples.cpu.002.pb.gz
Serving web UI on http://localhost:8888
Couldn't find a suitable web browser!
Set the BROWSER environment variable to your desired browser.
$ go get -u github.com/google/pprof $ sudo apt install graphviz
「ベンチをまわしながら」 以下を起動する。(動いているものに、後からアタッチするということである)
localhostにしかbindしてないんで、pfする
$ ssh isucon@i1.cfe.jp -L 8888:127.0.0.1:8888