diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-06-27 23:12:58 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-06-30 06:51:02 +0800 |
commit | 2aeeb72fa5c4f90d0ab072a361a678c3cdee8e26 (patch) | |
tree | 8b3a9064a185a0b80f5eeea4a3fb40f5d5995585 /cmd/geth/main.go | |
parent | 7c4ed8055cc036214279e3ebded74c58d6808d05 (diff) | |
download | dexon-2aeeb72fa5c4f90d0ab072a361a678c3cdee8e26.tar dexon-2aeeb72fa5c4f90d0ab072a361a678c3cdee8e26.tar.gz dexon-2aeeb72fa5c4f90d0ab072a361a678c3cdee8e26.tar.bz2 dexon-2aeeb72fa5c4f90d0ab072a361a678c3cdee8e26.tar.lz dexon-2aeeb72fa5c4f90d0ab072a361a678c3cdee8e26.tar.xz dexon-2aeeb72fa5c4f90d0ab072a361a678c3cdee8e26.tar.zst dexon-2aeeb72fa5c4f90d0ab072a361a678c3cdee8e26.zip |
cmd/geth, metrics: separate process metric collection, add disk
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r-- | cmd/geth/main.go | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index fcf7f27f0..6a52159ea 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -39,11 +39,11 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/comms" "github.com/mattn/go-colorable" "github.com/mattn/go-isatty" - "github.com/rcrowley/go-metrics" ) const ( @@ -288,27 +288,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso return nil } // Start system runtime metrics collection - go func() { - allocs := metrics.GetOrRegisterMeter("system/memory/allocs", metrics.DefaultRegistry) - frees := metrics.GetOrRegisterMeter("system/memory/frees", metrics.DefaultRegistry) - inuse := metrics.GetOrRegisterMeter("system/memory/inuse", metrics.DefaultRegistry) - pauses := metrics.GetOrRegisterMeter("system/memory/pauses", metrics.DefaultRegistry) - - stats := make([]*runtime.MemStats, 2) - for i := 0; i < len(stats); i++ { - stats[i] = new(runtime.MemStats) - } - for i := 1; ; i++ { - runtime.ReadMemStats(stats[i%2]) - - allocs.Mark(int64(stats[i%2].Mallocs - stats[(i-1)%2].Mallocs)) - frees.Mark(int64(stats[i%2].Frees - stats[(i-1)%2].Frees)) - inuse.Mark(int64(stats[i%2].Alloc - stats[(i-1)%2].Alloc)) - pauses.Mark(int64(stats[i%2].PauseTotalNs - stats[(i-1)%2].PauseTotalNs)) - - time.Sleep(3 * time.Second) - } - }() + go metrics.CollectProcessMetrics(3 * time.Second) } func main() { |