diff --git a/cmd/mttilemapper/main.go b/cmd/mttilemapper/main.go index 87fea0c..e5d91d7 100644 --- a/cmd/mttilemapper/main.go +++ b/cmd/mttilemapper/main.go @@ -10,6 +10,8 @@ import ( "image" "image/color" "log" + "os" + "runtime/pprof" "bitbucket.org/s_l_teichmann/mtsatellite/common" ) @@ -24,6 +26,7 @@ func main() { outfile string shaded bool transparent bool + cpuProfile string ) flag.IntVar(&port, "port", 6379, "port to of mtredisalize server") @@ -43,9 +46,19 @@ func main() { flag.StringVar(&outfile, "o", "out.png", "image file of result (shorthand)") flag.BoolVar(&shaded, "shaded", true, "draw relief") flag.BoolVar(&transparent, "transparent", false, "render transparent blocks") + flag.StringVar(&cpuProfile, "cpuprofile", "", "write cpu profile to file") flag.Parse() + if cpuProfile != "" { + f, err := os.Create(cpuProfile) + if err != nil { + log.Fatal(err) + } + pprof.StartCPUProfile(f) + defer pprof.StopCPUProfile() + } + var err error var colors *common.Colors