added ngo flag and default worker value (NumCpu) #4
3
check.go
3
check.go
@ -94,8 +94,7 @@ func check(files []string) chan error {
|
|||||||
|
|
||||||
results := []<-chan error{}
|
results := []<-chan error{}
|
||||||
|
|
||||||
workers := 32
|
for w := 0; w < *ngo; w++ {
|
||||||
for w := 0; w < workers; w++ {
|
|
||||||
results = append(results, compute(jobs))
|
results = append(results, compute(jobs))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
main.go
2
main.go
@ -9,10 +9,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
var algo = flag.String("a", "sha1", "algorithm to use")
|
var algo = flag.String("a", "sha1", "algorithm to use")
|
||||||
var mode = flag.Bool("c", false, "check")
|
var mode = flag.Bool("c", false, "check")
|
||||||
|
var ngo = flag.Int("n", runtime.NumCPU(), "number of goroutines")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
Loading…
Reference in New Issue
Block a user