Fix xgo patch 0002 (#1141)
This commit is contained in:
parent
fb1e30c5f4
commit
4219d56909
|
@ -1,8 +1,8 @@
|
||||||
diff --git i/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go w/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
|
diff --git a/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go b/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
|
||||||
index 399fa34c0..711dc8c34 100644
|
index 3ba92ac7..d89a1e94 100644
|
||||||
--- i/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
|
--- a/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
|
||||||
+++ w/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
|
+++ b/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
|
||||||
@@ -27,14 +27,11 @@ import (
|
@@ -27,20 +27,17 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -11,27 +11,48 @@ index 399fa34c0..711dc8c34 100644
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"io"
|
||||||
|
|
||||||
- "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/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"
|
||||||
@@ -261,109 +258,6 @@ func (db *Dashboard) apiHandler(conn *websocket.Conn) {
|
- "github.com/mohae/deepcopy"
|
||||||
|
"golang.org/x/net/websocket"
|
||||||
|
)
|
||||||
|
|
||||||
|
@@ -235,7 +232,7 @@ func (db *Dashboard) apiHandler(conn *websocket.Conn) {
|
||||||
|
|
||||||
|
db.lock.Lock()
|
||||||
|
// Send the past data.
|
||||||
|
- client.msg <- deepcopy.Copy(db.history).(*Message)
|
||||||
|
+ client.msg <- db.history
|
||||||
|
// Start tracking the connection and drop at connection loss.
|
||||||
|
db.conns[id] = client
|
||||||
|
db.lock.Unlock()
|
||||||
|
@@ -275,118 +272,6 @@ func meterCollector(name string) func() int64 {
|
||||||
// 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
|
- mem runtime.MemStats
|
||||||
-
|
-
|
||||||
- prevNetworkIngress = metrics.DefaultRegistry.Get("p2p/InboundTraffic").(metrics.Meter).Count()
|
- collectNetworkIngress = meterCollector("p2p/InboundTraffic")
|
||||||
- prevNetworkEgress = metrics.DefaultRegistry.Get("p2p/OutboundTraffic").(metrics.Meter).Count()
|
- collectNetworkEgress = meterCollector("p2p/OutboundTraffic")
|
||||||
|
- collectDiskRead = meterCollector("eth/db/chaindata/disk/read")
|
||||||
|
- collectDiskWrite = meterCollector("eth/db/chaindata/disk/write")
|
||||||
|
-
|
||||||
|
- prevNetworkIngress = collectNetworkIngress()
|
||||||
|
- prevNetworkEgress = collectNetworkEgress()
|
||||||
- prevProcessCPUTime = getProcessCPUTime()
|
- prevProcessCPUTime = getProcessCPUTime()
|
||||||
- prevSystemCPUUsage = systemCPUUsage
|
- prevSystemCPUUsage = systemCPUUsage
|
||||||
- prevDiskRead = metrics.DefaultRegistry.Get("eth/db/chaindata/disk/read").(metrics.Meter).Count()
|
- prevDiskRead = collectDiskRead()
|
||||||
- prevDiskWrite = metrics.DefaultRegistry.Get("eth/db/chaindata/disk/write").(metrics.Meter).Count()
|
- prevDiskWrite = collectDiskWrite()
|
||||||
-
|
-
|
||||||
- frequency = float64(db.config.Refresh / time.Second)
|
- frequency = float64(db.config.Refresh / time.Second)
|
||||||
- numCPU = float64(runtime.NumCPU())
|
- numCPU = float64(runtime.NumCPU())
|
||||||
|
@ -45,12 +66,12 @@ index 399fa34c0..711dc8c34 100644
|
||||||
- case <-time.After(db.config.Refresh):
|
- case <-time.After(db.config.Refresh):
|
||||||
- systemCPUUsage.Get()
|
- systemCPUUsage.Get()
|
||||||
- var (
|
- var (
|
||||||
- curNetworkIngress = metrics.DefaultRegistry.Get("p2p/InboundTraffic").(metrics.Meter).Count()
|
- curNetworkIngress = collectNetworkIngress()
|
||||||
- curNetworkEgress = metrics.DefaultRegistry.Get("p2p/OutboundTraffic").(metrics.Meter).Count()
|
- curNetworkEgress = collectNetworkEgress()
|
||||||
- curProcessCPUTime = getProcessCPUTime()
|
- curProcessCPUTime = getProcessCPUTime()
|
||||||
- curSystemCPUUsage = systemCPUUsage
|
- curSystemCPUUsage = systemCPUUsage
|
||||||
- curDiskRead = metrics.DefaultRegistry.Get("eth/db/chaindata/disk/read").(metrics.Meter).Count()
|
- curDiskRead = collectDiskRead()
|
||||||
- curDiskWrite = metrics.DefaultRegistry.Get("eth/db/chaindata/disk/write").(metrics.Meter).Count()
|
- curDiskWrite = collectDiskWrite()
|
||||||
-
|
-
|
||||||
- deltaNetworkIngress = float64(curNetworkIngress - prevNetworkIngress)
|
- deltaNetworkIngress = float64(curNetworkIngress - prevNetworkIngress)
|
||||||
- deltaNetworkEgress = float64(curNetworkEgress - prevNetworkEgress)
|
- deltaNetworkEgress = float64(curNetworkEgress - prevNetworkEgress)
|
||||||
|
@ -101,14 +122,17 @@ index 399fa34c0..711dc8c34 100644
|
||||||
- Time: now,
|
- Time: now,
|
||||||
- Value: float64(deltaDiskWrite) / frequency,
|
- Value: float64(deltaDiskWrite) / frequency,
|
||||||
- }
|
- }
|
||||||
- db.charts.ActiveMemory = append(db.charts.ActiveMemory[1:], activeMemory)
|
- sys := db.history.System
|
||||||
- db.charts.VirtualMemory = append(db.charts.VirtualMemory[1:], virtualMemory)
|
- db.lock.Lock()
|
||||||
- db.charts.NetworkIngress = append(db.charts.NetworkIngress[1:], networkIngress)
|
- sys.ActiveMemory = append(sys.ActiveMemory[1:], activeMemory)
|
||||||
- db.charts.NetworkEgress = append(db.charts.NetworkEgress[1:], networkEgress)
|
- sys.VirtualMemory = append(sys.VirtualMemory[1:], virtualMemory)
|
||||||
- db.charts.ProcessCPU = append(db.charts.ProcessCPU[1:], processCPU)
|
- sys.NetworkIngress = append(sys.NetworkIngress[1:], networkIngress)
|
||||||
- db.charts.SystemCPU = append(db.charts.SystemCPU[1:], systemCPU)
|
- sys.NetworkEgress = append(sys.NetworkEgress[1:], networkEgress)
|
||||||
- db.charts.DiskRead = append(db.charts.DiskRead[1:], diskRead)
|
- sys.ProcessCPU = append(sys.ProcessCPU[1:], processCPU)
|
||||||
- db.charts.DiskWrite = append(db.charts.DiskRead[1:], diskWrite)
|
- sys.SystemCPU = append(sys.SystemCPU[1:], systemCPU)
|
||||||
|
- sys.DiskRead = append(sys.DiskRead[1:], diskRead)
|
||||||
|
- sys.DiskWrite = append(sys.DiskWrite[1:], diskWrite)
|
||||||
|
- db.lock.Unlock()
|
||||||
-
|
-
|
||||||
- db.sendToAll(&Message{
|
- db.sendToAll(&Message{
|
||||||
- System: &SystemMessage{
|
- System: &SystemMessage{
|
||||||
|
@ -126,4 +150,4 @@ index 399fa34c0..711dc8c34 100644
|
||||||
- }
|
- }
|
||||||
}
|
}
|
||||||
|
|
||||||
// collectLogs collects and sends the logs to the active dashboards.
|
// sendToAll sends the given message to the active dashboards.
|
||||||
|
|
Loading…
Reference in New Issue