added profiling capability

This commit is contained in:
Todd Gruben 2014-04-17 03:13:06 -05:00
parent 00643c3ad9
commit 83a05152c3

View file

@ -1,10 +1,25 @@
package main
import (
"flag"
"log"
"os"
"pilosa/cruncher"
"runtime/pprof"
)
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
func main() {
flag.Parse()
if *cpuprofile != "" {
f, err := os.Create(*cpuprofile)
if err != nil {
log.Fatal(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
cruncher := cruncher.NewCruncher()
cruncher.Run()
}