-
Notifications
You must be signed in to change notification settings - Fork 1
/
runner.go
60 lines (52 loc) · 1023 Bytes
/
runner.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package main
import (
"flag"
"log"
"os"
"runtime/pprof"
"github.com/Flokey82/genworldvoronoi"
)
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
var memprofile = flag.String("memprofile", "", "write memory profile to this file")
func main() {
flag.Parse()
if *cpuprofile != "" {
f, err := os.Create(*cpuprofile)
if err != nil {
log.Fatal(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
cfg := genworldvoronoi.NewConfig()
sp, err := genworldvoronoi.NewMapFromConfig(1234, cfg)
if err != nil {
log.Fatal(err)
}
sp.GetEmpires()
exportPNG := false
exportOBJ := false
exportSVG := true
exportWebp := false
if exportPNG {
sp.ExportPng("test.png")
}
if exportOBJ {
sp.ExportOBJ("test.obj")
}
if exportSVG {
sp.ExportSVG("test.svg")
}
if exportWebp {
sp.ExportWebp("test.webp")
}
if *memprofile != "" {
f, err := os.Create(*memprofile)
if err != nil {
log.Fatal(err)
}
pprof.WriteHeapProfile(f)
f.Close()
return
}
}