diff options
author | Felix Lange <fjl@users.noreply.github.com> | 2018-04-23 21:20:39 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-04-23 21:20:39 +0800 |
commit | e7067be94f0edb47b39d4fa1725bce18bdadf122 (patch) | |
tree | 03da66169154814fd5eee6a4aba2b2a3790ff739 /mobile | |
parent | 9586f2acc76f10c4a7ce364291d075997c5f8eff (diff) | |
download | dexon-e7067be94f0edb47b39d4fa1725bce18bdadf122.tar.gz dexon-e7067be94f0edb47b39d4fa1725bce18bdadf122.tar.zst dexon-e7067be94f0edb47b39d4fa1725bce18bdadf122.zip |
cmd/geth, mobile: add memsize to pprof server (#16532)
* cmd/geth, mobile: add memsize to pprof server
This is a temporary change, to be reverted before the next release.
* cmd/geth: fix variable name
Diffstat (limited to 'mobile')
-rw-r--r-- | mobile/geth.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mobile/geth.go b/mobile/geth.go index 488a4150f..645b360eb 100644 --- a/mobile/geth.go +++ b/mobile/geth.go @@ -29,6 +29,7 @@ import ( "github.com/ethereum/go-ethereum/eth/downloader" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/ethstats" + "github.com/ethereum/go-ethereum/internal/debug" "github.com/ethereum/go-ethereum/les" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/p2p" @@ -72,6 +73,9 @@ type NodeConfig struct { // WhisperEnabled specifies whether the node should run the Whisper protocol. WhisperEnabled bool + + // Listening address of pprof server. + PprofAddress string } // defaultNodeConfig contains the default node configuration values to use if all @@ -107,6 +111,11 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) { if config.BootstrapNodes == nil || config.BootstrapNodes.Size() == 0 { config.BootstrapNodes = defaultNodeConfig.BootstrapNodes } + + if config.PprofAddress != "" { + debug.StartPProf(config.PprofAddress) + } + // Create the empty networking stack nodeConf := &node.Config{ Name: clientIdentifier, @@ -127,6 +136,8 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) { return nil, err } + debug.Memsize.Add("node", rawStack) + var genesis *core.Genesis if config.EthereumGenesis != "" { // Parse the user supplied genesis spec if not mainnet |