Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flag for setting runtime.GOMAXPROCS #35

Merged
merged 3 commits into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cmd/go-tpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"os"
"os/signal"
"runtime"
"strings"
"syscall"
"time"
Expand Down Expand Up @@ -34,6 +33,7 @@ var (
silence bool
summaryReport bool
pprofAddr string
maxProcs int

globalDB *sql.DB
globalCtx context.Context
Expand Down Expand Up @@ -83,8 +83,7 @@ func main() {
Use: "go-tpc",
Short: "Benchmark database with different workloads",
}
runtime.GOMAXPROCS(runtime.NumCPU())

rootCmd.PersistentFlags().IntVar(&maxProcs, "max-procs", 0, "runtime.GOMAXPROCS")
rootCmd.PersistentFlags().StringVar(&pprofAddr, "pprof", "", "Address of pprof endpoint")
rootCmd.PersistentFlags().StringVarP(&dbName, "db", "D", "test", "Database name")
rootCmd.PersistentFlags().StringVarP(&host, "host", "H", "127.0.0.1", "Database host")
Expand Down
2 changes: 2 additions & 0 deletions cmd/go-tpc/tpcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"
_ "net/http/pprof"
"os"
"runtime"

"github.com/pingcap/go-tpc/tpcc"
"github.com/spf13/cobra"
Expand All @@ -19,6 +20,7 @@ func executeTpcc(action string) {
http.ListenAndServe(pprofAddr, http.DefaultServeMux)
}()
}
runtime.GOMAXPROCS(maxProcs)

openDB()
defer closeDB()
Expand Down