forked from cerc-io/plugeth
cmd/geth: finalize mem stats
This commit is contained in:
parent
fdbf8be735
commit
e9c0b5431c
@ -289,10 +289,10 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
|
|||||||
}
|
}
|
||||||
// Start system runtime metrics collection
|
// Start system runtime metrics collection
|
||||||
go func() {
|
go func() {
|
||||||
used := metrics.GetOrRegisterMeter("system/memory/used", metrics.DefaultRegistry)
|
allocs := metrics.GetOrRegisterMeter("system/memory/allocs", metrics.DefaultRegistry)
|
||||||
total := metrics.GetOrRegisterMeter("system/memory/total", metrics.DefaultRegistry)
|
|
||||||
mallocs := metrics.GetOrRegisterMeter("system/memory/mallocs", metrics.DefaultRegistry)
|
|
||||||
frees := metrics.GetOrRegisterMeter("system/memory/frees", 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)
|
stats := make([]*runtime.MemStats, 2)
|
||||||
for i := 0; i < len(stats); i++ {
|
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++ {
|
for i := 1; ; i++ {
|
||||||
runtime.ReadMemStats(stats[i%2])
|
runtime.ReadMemStats(stats[i%2])
|
||||||
|
|
||||||
used.Mark(int64(stats[i%2].Alloc - stats[(i-1)%2].Alloc))
|
allocs.Mark(int64(stats[i%2].Mallocs - stats[(i-1)%2].Mallocs))
|
||||||
total.Mark(int64(stats[i%2].TotalAlloc - stats[(i-1)%2].TotalAlloc))
|
|
||||||
mallocs.Mark(int64(stats[i%2].Mallocs - stats[(i-1)%2].Mallocs))
|
|
||||||
frees.Mark(int64(stats[i%2].Frees - stats[(i-1)%2].Frees))
|
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)
|
time.Sleep(3 * time.Second)
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ func updateChart(metric string, data []float64, chart *termui.LineChart, err err
|
|||||||
chart.Border.Label = metric
|
chart.Border.Label = metric
|
||||||
|
|
||||||
units := dataUnits
|
units := dataUnits
|
||||||
if strings.Contains(metric, "Percentiles") {
|
if strings.Contains(metric, "/Percentiles/") || strings.Contains(metric, "/pauses/") {
|
||||||
units = timeUnits
|
units = timeUnits
|
||||||
}
|
}
|
||||||
if len(units[unit]) > 0 {
|
if len(units[unit]) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user