dotcloud/docker — pull request #2818 by pnasrat (2013-11-22 15:58:55+00:00)
Title: Wire in pprof handlers.

Based on http://stackoverflow.com/questions/19591065/profiling-go-web-application-built-with-gorillas-mux-with-net-http-pprof

Tested using `docker -d -D -H=unix:///var/run/docker.sock -H=tcp://127.0.0.1:4343` then running the following in parallel (you need to generate load in order for pprof to work!).

```
go tool pprof http://localhost:4343/debug/pprof/profile
```

and

```
for i in $(seq 1 40); do docker run -d -t busybox sleep 600; done && docker ps
```

Sample output:

```
Total: 46 samples
17 37.0% 37.0% 20 43.5% syscall.Syscall
9 19.6% 56.5% 9 19.6% 0x00007fff647f48a2
7 15.2% 71.7% 7 15.2% runtime.usleep
6 13.0% 84.8% 6 13.0% runtime.futex
2 4.3% 89.1% 2 4.3% runtime.epollwait
1 2.2% 91.3% 1 2.2% 0x000000000078341b
1 2.2% 93.5% 2 4.3% github.com/dotcloud/docker.(*Container).Start
1 2.2% 95.7% 4 8.7% net.(*conn).Read
1 2.2% 97.8% 1 2.2% runtime.mallocgc
1 2.2% 100.0% 1 2.2% runtime.memmove
```