codahale/http-handlers — pull request #4 by toffaletti (2014-11-13 01:47:40+00:00)
Title: add blocking profile handler

Example usage:

```
package main

import (
"net/http"
"time"

"github.com/codahale/http-handlers/debug"
)

func main() {
ch := make(chan int)
go func() {
for {
ch <- 1
}
}()
go func() {
for {
select {
case <- ch:
default:
time.Sleep(1)
}
}
}()
http.ListenAndServe(":8080", debug.Wrap(http.HandlerFunc(http.NotFound)))
}
```

```
$ go tool pprof http://localhost:8080/debug/pprof/block
Read http://localhost:8080/debug/pprof/symbol
Fetching /pprof/block profile from localhost:8080 to
/var/folders/3k/xcbr5k6s4f5ddvdjv0xd87z00000gn/T/4fJElFuB9K
Wrote profile to /var/folders/3k/xcbr5k6s4f5ddvdjv0xd87z00000gn/T/4fJElFuB9K
Welcome to pprof! For help, type 'help'.
(pprof) top10
Total: 19.604 seconds
19.604 100.0% 100.0% 19.604 100.0% runtime.chansend1
0.000 0.0% 100.0% 19.604 100.0% main.func·001
0.000 0.0% 100.0% 19.604 100.0% runtime.goexit
```

I have no idea how to unit test this.