func Capture(p Profile) {
	go capture(p)
}
TODO(jbd): Add support for custom.
Capture captures the given profiles at SIGINT
and opens a browser with the collected profiles.

Capture should be used in development-time
and shouldn't be in production binaries.
package autopprof
import (
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"os/exec"
	"os/signal"
	"runtime"
	"runtime/pprof"
	"syscall"
	"time"
)
type Profile interface {
	Capture() (profile string, err error)
}
type CPUProfile struct {
	Duration time.Duration  
}
func (p CPUProfile) Capture() (string, error) {
	dur := p.Duration
	if dur == 0 {
		dur = 30 * time.Second
	}
	f := newTemp()
	if err := pprof.StartCPUProfile(f); err != nil {
		return "", nil
	}
	time.Sleep(dur)
	pprof.StopCPUProfile()
	if err := f.Close(); err != nil {
		return "", nil
	}
	return f.Name(), nil
}
type HeapProfile struct{}
func (p HeapProfile) Capture() (string, error) {
	return captureProfile("heap")
}
type MutexProfile struct{}
func (p MutexProfile) Capture() (string, error) {
	return captureProfile("mutex")
}
type BlockProfile struct {
	Rate int
}
func (p BlockProfile) Capture() (string, error) {
	if p.Rate > 0 {
		runtime.SetBlockProfileRate(p.Rate)
	}
	return captureProfile("block")
}
type GoroutineProfile struct{}
func (p GoroutineProfile) Capture() (string, error) {
	return captureProfile("goroutine")
}
type ThreadcreateProfile struct{}
func (p ThreadcreateProfile) Capture() (string, error) {
	return captureProfile("threadcreate")
}
func captureProfile(name string) (string, error) {
	f := newTemp()
	if err := pprof.Lookup(name).WriteTo(f, 2); err != nil {
		return "", nil
	}
	if err := f.Close(); err != nil {
		return "", nil
	}
	return f.Name(), nil
}