From c8e2b3710cec47f023fd01c42ea829579a2753be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 20 Apr 2015 18:59:41 +0300 Subject: [PATCH] cmd/geth, cmd/utils: use pprof disable flag, start globally --- cmd/geth/main.go | 12 +++++++----- cmd/utils/flags.go | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index de1a59772..5695c4117 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -245,9 +245,15 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso utils.LogVModuleFlag, utils.LogFileFlag, utils.LogJSONFlag, - utils.PProfEnabledFlag, + utils.PProfDisabledFlag, utils.PProfPortFlag, } + app.Before = func(ctx *cli.Context) error { + if !ctx.GlobalBool(utils.PProfDisabledFlag.Name) { + utils.StartPProf(ctx) + } + return nil + } // missing: // flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file") @@ -332,10 +338,6 @@ func unlockAccount(ctx *cli.Context, am *accounts.Manager, account string) (pass } func startEth(ctx *cli.Context, eth *eth.Ethereum) { - // Start profiling, if requested - if ctx.GlobalBool(utils.PProfEnabledFlag.Name) { - utils.StartPProf(ctx) - } // Start Ethereum itself utils.StartEthereum(eth) am := eth.AccountManager() diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 3b1fda32e..429007642 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -157,9 +157,9 @@ var ( Usage: "When set to a file and line number holding a logging statement a stack trace will be written to the Info log", Value: glog.GetTraceLocation(), } - PProfEnabledFlag = cli.BoolFlag{ - Name: "pprof", - Usage: "Whether the profiling server is enabled", + PProfDisabledFlag = cli.BoolFlag{ + Name: "nopprof", + Usage: "Whether the profiling server should be disabled", } PProfPortFlag = cli.IntFlag{ Name: "pprofport",