cmd/geth, cmd/utils: use pprof disable flag, start globally

This commit is contained in:
Péter Szilágyi 2015-04-20 18:59:41 +03:00
parent 8830403acf
commit c8e2b3710c
2 changed files with 10 additions and 8 deletions

@ -245,9 +245,15 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.LogVModuleFlag, utils.LogVModuleFlag,
utils.LogFileFlag, utils.LogFileFlag,
utils.LogJSONFlag, utils.LogJSONFlag,
utils.PProfEnabledFlag, utils.PProfDisabledFlag,
utils.PProfPortFlag, utils.PProfPortFlag,
} }
app.Before = func(ctx *cli.Context) error {
if !ctx.GlobalBool(utils.PProfDisabledFlag.Name) {
utils.StartPProf(ctx)
}
return nil
}
// missing: // missing:
// flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file") // 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) { func startEth(ctx *cli.Context, eth *eth.Ethereum) {
// Start profiling, if requested
if ctx.GlobalBool(utils.PProfEnabledFlag.Name) {
utils.StartPProf(ctx)
}
// Start Ethereum itself // Start Ethereum itself
utils.StartEthereum(eth) utils.StartEthereum(eth)
am := eth.AccountManager() am := eth.AccountManager()

@ -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", 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(), Value: glog.GetTraceLocation(),
} }
PProfEnabledFlag = cli.BoolFlag{ PProfDisabledFlag = cli.BoolFlag{
Name: "pprof", Name: "nopprof",
Usage: "Whether the profiling server is enabled", Usage: "Whether the profiling server should be disabled",
} }
PProfPortFlag = cli.IntFlag{ PProfPortFlag = cli.IntFlag{
Name: "pprofport", Name: "pprofport",