Skip to content
Snippets Groups Projects
Commit c13a0173 authored by Ashwin's avatar Ashwin
Browse files

Added --numCpu flag

parent b1c420ca
Branches
Tags
No related merge requests found
File added
...@@ -38,6 +38,7 @@ var rdfGzips = flag.String("rdfgzips", "", ...@@ -38,6 +38,7 @@ var rdfGzips = flag.String("rdfgzips", "",
var mod = flag.Uint64("mod", 1, "Only pick entities, where uid % mod == 0.") var mod = flag.Uint64("mod", 1, "Only pick entities, where uid % mod == 0.")
var postingDir = flag.String("postings", "", "Directory to store posting lists") var postingDir = flag.String("postings", "", "Directory to store posting lists")
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file") var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
var numcpu = flag.Int("numCpu", runtime.NumCPU(), "Number of cores to be used by the process")
func main() { func main() {
flag.Parse() flag.Parse()
...@@ -54,7 +55,7 @@ func main() { ...@@ -54,7 +55,7 @@ func main() {
} }
logrus.SetLevel(logrus.InfoLevel) logrus.SetLevel(logrus.InfoLevel)
numCpus := runtime.NumCPU() numCpus := *numcpu
prevProcs := runtime.GOMAXPROCS(numCpus) prevProcs := runtime.GOMAXPROCS(numCpus)
glog.WithField("num_cpu", numCpus). glog.WithField("num_cpu", numCpus).
WithField("prev_maxprocs", prevProcs). WithField("prev_maxprocs", prevProcs).
......
...@@ -38,6 +38,7 @@ var glog = x.Log("server") ...@@ -38,6 +38,7 @@ var glog = x.Log("server")
var postingDir = flag.String("postings", "", "Directory to store posting lists") var postingDir = flag.String("postings", "", "Directory to store posting lists")
var mutationDir = flag.String("mutations", "", "Directory to store mutations") var mutationDir = flag.String("mutations", "", "Directory to store mutations")
var port = flag.String("port", "8080", "Port to run server on.") var port = flag.String("port", "8080", "Port to run server on.")
var numcpu = flag.Int("numCpu", runtime.NumCPU(), "Number of cores to be used by the process")
func addCorsHeaders(w http.ResponseWriter) { func addCorsHeaders(w http.ResponseWriter) {
w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Origin", "*")
...@@ -109,7 +110,7 @@ func main() { ...@@ -109,7 +110,7 @@ func main() {
glog.Fatal("Unable to parse flags") glog.Fatal("Unable to parse flags")
} }
logrus.SetLevel(logrus.InfoLevel) logrus.SetLevel(logrus.InfoLevel)
numCpus := runtime.NumCPU() numCpus := *numcpu
prev := runtime.GOMAXPROCS(numCpus) prev := runtime.GOMAXPROCS(numCpus)
glog.WithField("num_cpu", numCpus). glog.WithField("num_cpu", numCpus).
WithField("prev_maxprocs", prev). WithField("prev_maxprocs", prev).
......
...@@ -22,6 +22,7 @@ var rdfGzips = flag.String("rdfgzips", "", ...@@ -22,6 +22,7 @@ var rdfGzips = flag.String("rdfgzips", "",
var mod = flag.Uint64("mod", 1, "Only pick entities, where uid % mod == 0.") var mod = flag.Uint64("mod", 1, "Only pick entities, where uid % mod == 0.")
var uidDir = flag.String("uidpostings", "", "Directory to store xid to uid posting lists") var uidDir = flag.String("uidpostings", "", "Directory to store xid to uid posting lists")
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file") var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
var numcpu = flag.Int("numCpu", runtime.NumCPU(), "Number of cores to be used by the process")
func main() { func main() {
flag.Parse() flag.Parse()
...@@ -39,7 +40,7 @@ func main() { ...@@ -39,7 +40,7 @@ func main() {
logrus.SetLevel(logrus.InfoLevel) logrus.SetLevel(logrus.InfoLevel)
numCpus := runtime.NumCPU() numCpus := *numcpu
prevProcs := runtime.GOMAXPROCS(numCpus) prevProcs := runtime.GOMAXPROCS(numCpus)
glog.WithField("num_cpus", numCpus). glog.WithField("num_cpus", numCpus).
WithField("prev_maxprocs", prevProcs). WithField("prev_maxprocs", prevProcs).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment