Parameterize number of CPUs to be used
This commit is contained in:
7
main.go
7
main.go
@@ -11,10 +11,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var (
|
var (
|
||||||
rate = flag.Uint64("rate", 50, "Requests per second")
|
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")
|
duration = flag.Duration("duration", 10*time.Second, "Duration of the test")
|
||||||
reporter = flag.String("reporter", "text", "Reporter to use [text, plot:timings]")
|
reporter = flag.String("reporter", "text", "Reporter to use [text, plot:timings]")
|
||||||
output = flag.String("output", "stdout", "Reporter output file")
|
output = flag.String("output", "stdout", "Reporter output file")
|
||||||
|
cpus = flag.Int("cpus", runtime.NumCPU(), "Number of CPUs to use")
|
||||||
)
|
)
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@@ -31,6 +28,8 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runtime.GOMAXPROCS(*cpus)
|
||||||
|
|
||||||
if err := run(*rate, *duration, *targetsf, *ordering, *reporter, *output); err != nil {
|
if err := run(*rate, *duration, *targetsf, *ordering, *reporter, *output); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user