More idiomatic flag descriptions

This commit is contained in:
Justin Li 2014-07-16 02:24:00 -04:00
parent ab3d49da9d
commit 2972aae231

14
main.go
View file

@ -22,14 +22,14 @@ import (
var ( var (
maxprocs int maxprocs int
profile bool profile string
configPath string configPath string
) )
func init() { func init() {
flag.IntVar(&maxprocs, "maxprocs", runtime.NumCPU(), "Specify the amount of OS threads used by the runtime") flag.IntVar(&maxprocs, "maxprocs", runtime.NumCPU(), "maximum parallel threads")
flag.BoolVar(&profile, "profile", false, "Generate profiling data for pprof into ./chihaya.cpu") flag.StringVar(&profile, "profile", "", "if non-empty, path to write profiling data")
flag.StringVar(&configPath, "config", "", "Provide the filesystem path of a valid configuration file") flag.StringVar(&configPath, "config", "", "path to the configuration file")
} }
func Boot() { func Boot() {
@ -38,10 +38,10 @@ func Boot() {
flag.Parse() flag.Parse()
runtime.GOMAXPROCS(maxprocs) runtime.GOMAXPROCS(maxprocs)
glog.Info("set gomaxprocs to ", maxprocs) glog.Info("set max threads to ", maxprocs)
if profile { if profile != "" {
f, err := os.Create("chihaya.cpu") f, err := os.Create(profile)
if err != nil { if err != nil {
glog.Fatalf("failed to create profile file: %s\n", err) glog.Fatalf("failed to create profile file: %s\n", err)
} }