Skip to content

Commit

Permalink
-Add cores of CPU feature
Browse files Browse the repository at this point in the history
  • Loading branch information
wgliang committed Apr 3, 2018
1 parent 91dd65f commit 09a24e1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"io/ioutil"
"log"
"os"
"runtime"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -52,11 +53,14 @@ var (
exceptPackages = flag.String("e", "", "except packages.")
templatePath = flag.String("t", "", "report html template path.")
reportFormat = flag.String("f", "", "project report format(text/json/html).")
coresOfCPU = flag.Int("c", -1, "cores of CPU.")
)

func main() {
flag.Parse()

if *coresOfCPU != -1 && *coresOfCPU <= runtime.NumCPU() {
runtime.GOMAXPROCS(*coresOfCPU)
}
if *version {
fmt.Printf("GoReporter %s\r\n", VERSION)
os.Exit(0)
Expand Down

0 comments on commit 09a24e1

Please sign in to comment.