Parameterize number of CPUs to be used

This commit is contained in:
Tomás Senart
2013-09-08 21:02:04 +01:00
parent 3eab2de2c1
commit b53c5f7a72

View File

@@ -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)
}