From bc9d3d209dbe07f5c064d26ca7aabcbcaf51aab9 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Wed, 16 Jul 2014 00:01:10 -0400 Subject: [PATCH] maxprocs exposed by flag --- main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index f836a44..2753a9f 100644 --- a/main.go +++ b/main.go @@ -21,13 +21,15 @@ import ( ) var ( + maxprocs int profile bool configPath string ) func init() { + flag.IntVar(&maxprocs, "maxprocs", runtime.NumCPU(), "Specify the amount of OS threads used by the runtime") flag.BoolVar(&profile, "profile", false, "Generate profiling data for pprof into ./chihaya.cpu") - flag.StringVar(&configPath, "config", "", "Provide the filesystem path of a valid configuration file.") + flag.StringVar(&configPath, "config", "", "Provide the filesystem path of a valid configuration file") } func Boot() { @@ -35,8 +37,8 @@ func Boot() { flag.Parse() - runtime.GOMAXPROCS(runtime.NumCPU()) - glog.Info("set gomaxprocs to ", runtime.NumCPU()) + runtime.GOMAXPROCS(maxprocs) + glog.Info("set gomaxprocs to ", maxprocs) if profile { f, err := os.Create("chihaya.cpu")