Changes in benchmark/readyQ/bench.go [2c7eee0:f4f79dd]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/readyQ/bench.go
r2c7eee0 rf4f79dd 5 5 "flag" 6 6 "fmt" 7 "log" 7 8 "os" 8 9 "runtime" 10 "runtime/pprof" 9 11 "sync/atomic" 10 12 "time" … … 43 45 } 44 46 45 func bench_init() {47 func bench_init() func() { 46 48 nprocsOpt := flag.Int("p", 1, "The number of processors") 47 49 nthreadsOpt := flag.Int("t", 1, "The number of threads") 48 50 durationOpt := flag.Float64("d", 0, "Duration of the experiment in seconds") 49 51 stopOpt := flag.Uint64("i", 0, "Duration of the experiment in iterations") 52 cpuprofile := flag.String("cpuprofile", "", "write cpu profile to file") 50 53 51 54 flag.Parse() … … 72 75 73 76 runtime.GOMAXPROCS(nprocs) 77 78 if (*cpuprofile) != "" { 79 f, err := os.Create(*cpuprofile) 80 if err != nil { 81 log.Fatal(err) 82 } 83 pprof.StartCPUProfile(f) 84 } 85 86 return func() { 87 if (*cpuprofile) != "" { 88 pprof.StopCPUProfile() 89 } 90 } 74 91 }
Note: See TracChangeset
for help on using the changeset viewer.