diff --git a/main.go b/main.go index af934ee..a1cba4e 100644 --- a/main.go +++ b/main.go @@ -11,10 +11,6 @@ import ( "time" ) -func init() { - runtime.GOMAXPROCS(runtime.NumCPU()) -} - func main() { var ( rate = flag.Uint64("rate", 50, "Requests per second") @@ -23,6 +19,7 @@ func main() { duration = flag.Duration("duration", 10*time.Second, "Duration of the test") reporter = flag.String("reporter", "text", "Reporter to use [text, plot:timings]") output = flag.String("output", "stdout", "Reporter output file") + cpus = flag.Int("cpus", runtime.NumCPU(), "Number of CPUs to use") ) flag.Parse() @@ -31,6 +28,8 @@ func main() { return } + runtime.GOMAXPROCS(*cpus) + if err := run(*rate, *duration, *targetsf, *ordering, *reporter, *output); err != nil { log.Fatal(err) }