Commit 7b2a08f2 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Automatically set the number of threads in bulkstat.

parent 93d87c60
......@@ -3,6 +3,7 @@ include $(GOROOT)/src/Make.inc
TARG=bulkstat
GOFILES=bulkstat.go
DEPS=../../fuse
include $(GOROOT)/src/Make.cmd
......@@ -4,20 +4,25 @@ package main
// in parallel. This is useful for benchmarking purposes.
import (
"github.com/hanwen/go-fuse/fuse"
"os"
"flag"
"time"
"fmt"
"encoding/line"
"runtime"
)
func main() {
threads := flag.Int("threads", 12, "number of parallel threads in a run.")
threads := flag.Int("threads", 0, "number of parallel threads in a run. If 0, use CPU count.")
sleepTime := flag.Float64("sleep", 4.0, "amount of sleep between runs.")
runs := flag.Int("runs", 10, "number of runs.")
flag.Parse()
if *threads == 0 {
*threads = fuse.CountCpus()
runtime.GOMAXPROCS(*threads)
}
filename := flag.Args()[0]
f, err := os.Open(filename)
if err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment