func (prof *CPUProfile) Stop() {
	pprof.StopCPUProfile()
	if prof == nil {
		return
	}
	if prof.f != nil {
		err := prof.f.Close()
		if err != nil {
			log.Println("CPUProfile.Stop: ", err)
		}
	}
}
Stop the CPU profiler.
package debug
import (
	"fmt"
	"log"
	"os"
	"runtime/pprof"
)
type CPUProfile struct {
	f *os.File
}
func NewCPUProfile(prefix string) (prof *CPUProfile) {
	var err error
	path := fmt.Sprintf("/tmp/%s.%d.cpu.pprof", prefix, os.Getpid())
	prof = &CPUProfile{}
	prof.f, err = os.Create(path)
	if err != nil {
		log.Println(prefix, ": NewCPUProfile:", err)
		return nil
	}
	err = pprof.StartCPUProfile(prof.f)
	if err != nil {
		prof.Stop()
		log.Println(prefix, ": NewCPUProfile:", err)
		return nil
	}
	return prof
}