From e9c0b5431cbd7430ddec9fd17983241018fd8a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 25 Jun 2015 16:19:42 +0300 Subject: [PATCH] cmd/geth: finalize mem stats --- cmd/geth/main.go | 12 ++++++------ cmd/geth/monitorcmd.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 53f6a95d9..fcf7f27f0 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -289,10 +289,10 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso } // Start system runtime metrics collection go func() { - used := metrics.GetOrRegisterMeter("system/memory/used", metrics.DefaultRegistry) - total := metrics.GetOrRegisterMeter("system/memory/total", metrics.DefaultRegistry) - mallocs := metrics.GetOrRegisterMeter("system/memory/mallocs", metrics.DefaultRegistry) + 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++ { @@ -301,10 +301,10 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso for i := 1; ; i++ { runtime.ReadMemStats(stats[i%2]) - used.Mark(int64(stats[i%2].Alloc - stats[(i-1)%2].Alloc)) - total.Mark(int64(stats[i%2].TotalAlloc - stats[(i-1)%2].TotalAlloc)) - mallocs.Mark(int64(stats[i%2].Mallocs - stats[(i-1)%2].Mallocs)) + 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) } diff --git a/cmd/geth/monitorcmd.go b/cmd/geth/monitorcmd.go index 43937dcaa..bb9c61a00 100644 --- a/cmd/geth/monitorcmd.go +++ b/cmd/geth/monitorcmd.go @@ -282,7 +282,7 @@ func updateChart(metric string, data []float64, chart *termui.LineChart, err err chart.Border.Label = metric units := dataUnits - if strings.Contains(metric, "Percentiles") { + if strings.Contains(metric, "/Percentiles/") || strings.Contains(metric, "/pauses/") { units = timeUnits } if len(units[unit]) > 0 {