Fix 0002 xgo patch which changed because metrics got forked

This commit is contained in:
Dmitry Shulyak 2018-05-02 16:29:04 +03:00 committed by Ivan Daniluk
parent 4438d116b1
commit c8a553f9c1
1 changed files with 16 additions and 18 deletions

View File

@ -1,11 +1,11 @@
diff --git a/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go b/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go diff --git i/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go w/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
index 09038638..070ecca3 100644 index 399fa34c0..711dc8c34 100644
--- a/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go --- i/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
+++ b/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go +++ w/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
@@ -29,17 +29,14 @@ import ( @@ -27,14 +27,11 @@ import (
"fmt"
"net" "net"
"net/http" "net/http"
"path/filepath"
- "runtime" - "runtime"
"sync" "sync"
"sync/atomic" "sync/atomic"
@ -13,26 +13,25 @@ index 09038638..070ecca3 100644
- "github.com/elastic/gosigar" - "github.com/elastic/gosigar"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
- "github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
- "github.com/rcrowley/go-metrics" @@ -261,109 +258,6 @@ func (db *Dashboard) apiHandler(conn *websocket.Conn) {
"golang.org/x/net/websocket"
)
@@ -274,108 +271,6 @@ func (db *Dashboard) apiHandler(conn *websocket.Conn) {
// collectData collects the required data to plot on the dashboard. // collectData collects the required data to plot on the dashboard.
func (db *Dashboard) collectData() { func (db *Dashboard) collectData() {
defer db.wg.Done() defer db.wg.Done()
- systemCPUUsage := gosigar.Cpu{} - systemCPUUsage := gosigar.Cpu{}
- systemCPUUsage.Get() - systemCPUUsage.Get()
- var ( - var (
- mem runtime.MemStats
-
- prevNetworkIngress = metrics.DefaultRegistry.Get("p2p/InboundTraffic").(metrics.Meter).Count() - prevNetworkIngress = metrics.DefaultRegistry.Get("p2p/InboundTraffic").(metrics.Meter).Count()
- prevNetworkEgress = metrics.DefaultRegistry.Get("p2p/OutboundTraffic").(metrics.Meter).Count() - prevNetworkEgress = metrics.DefaultRegistry.Get("p2p/OutboundTraffic").(metrics.Meter).Count()
- prevProcessCPUTime = getProcessCPUTime() - prevProcessCPUTime = getProcessCPUTime()
- prevSystemCPUUsage = systemCPUUsage - prevSystemCPUUsage = systemCPUUsage
- prevDiskRead = metrics.DefaultRegistry.Get("eth/db/chaindata/compact/input").(metrics.Meter).Count() - prevDiskRead = metrics.DefaultRegistry.Get("eth/db/chaindata/disk/read").(metrics.Meter).Count()
- prevDiskWrite = metrics.DefaultRegistry.Get("eth/db/chaindata/compact/output").(metrics.Meter).Count() - prevDiskWrite = metrics.DefaultRegistry.Get("eth/db/chaindata/disk/write").(metrics.Meter).Count()
- -
- frequency = float64(db.config.Refresh / time.Second) - frequency = float64(db.config.Refresh / time.Second)
- numCPU = float64(runtime.NumCPU()) - numCPU = float64(runtime.NumCPU())
@ -50,13 +49,13 @@ index 09038638..070ecca3 100644
- curNetworkEgress = metrics.DefaultRegistry.Get("p2p/OutboundTraffic").(metrics.Meter).Count() - curNetworkEgress = metrics.DefaultRegistry.Get("p2p/OutboundTraffic").(metrics.Meter).Count()
- curProcessCPUTime = getProcessCPUTime() - curProcessCPUTime = getProcessCPUTime()
- curSystemCPUUsage = systemCPUUsage - curSystemCPUUsage = systemCPUUsage
- curDiskRead = metrics.DefaultRegistry.Get("eth/db/chaindata/compact/input").(metrics.Meter).Count() - curDiskRead = metrics.DefaultRegistry.Get("eth/db/chaindata/disk/read").(metrics.Meter).Count()
- curDiskWrite = metrics.DefaultRegistry.Get("eth/db/chaindata/compact/output").(metrics.Meter).Count() - curDiskWrite = metrics.DefaultRegistry.Get("eth/db/chaindata/disk/write").(metrics.Meter).Count()
- -
- deltaNetworkIngress = float64(curNetworkIngress - prevNetworkIngress) - deltaNetworkIngress = float64(curNetworkIngress - prevNetworkIngress)
- deltaNetworkEgress = float64(curNetworkEgress - prevNetworkEgress) - deltaNetworkEgress = float64(curNetworkEgress - prevNetworkEgress)
- deltaProcessCPUTime = curProcessCPUTime - prevProcessCPUTime - deltaProcessCPUTime = curProcessCPUTime - prevProcessCPUTime
- deltaSystemCPUUsage = systemCPUUsage.Delta(prevSystemCPUUsage) - deltaSystemCPUUsage = curSystemCPUUsage.Delta(prevSystemCPUUsage)
- deltaDiskRead = curDiskRead - prevDiskRead - deltaDiskRead = curDiskRead - prevDiskRead
- deltaDiskWrite = curDiskWrite - prevDiskWrite - deltaDiskWrite = curDiskWrite - prevDiskWrite
- ) - )
@ -69,7 +68,6 @@ index 09038638..070ecca3 100644
- -
- now := time.Now() - now := time.Now()
- -
- var mem runtime.MemStats
- runtime.ReadMemStats(&mem) - runtime.ReadMemStats(&mem)
- activeMemory := &ChartEntry{ - activeMemory := &ChartEntry{
- Time: now, - Time: now,
@ -113,7 +111,7 @@ index 09038638..070ecca3 100644
- db.charts.DiskWrite = append(db.charts.DiskRead[1:], diskWrite) - db.charts.DiskWrite = append(db.charts.DiskRead[1:], diskWrite)
- -
- db.sendToAll(&Message{ - db.sendToAll(&Message{
- Home: &HomeMessage{ - System: &SystemMessage{
- ActiveMemory: ChartEntries{activeMemory}, - ActiveMemory: ChartEntries{activeMemory},
- VirtualMemory: ChartEntries{virtualMemory}, - VirtualMemory: ChartEntries{virtualMemory},
- NetworkIngress: ChartEntries{networkIngress}, - NetworkIngress: ChartEntries{networkIngress},