()
| 28 | var cpuProfile = flag.String("cpuprofile", "", "where to write cpu profile") |
| 29 | |
| 30 | func main() { |
| 31 | flag.Parse() |
| 32 | f, err := os.Create(*cpuProfile) |
| 33 | if err != nil { |
| 34 | log.Fatal("could not create CPU profile: ", err) |
| 35 | } |
| 36 | if err := pprof.StartCPUProfile(f); err != nil { |
| 37 | log.Fatal("could not start CPU profile: ", err) |
| 38 | } |
| 39 | defer pprof.StopCPUProfile() |
| 40 | busyLoop() |
| 41 | } |
| 42 | |
| 43 | func busyLoop() { |
| 44 | m := make(map[int]int) |