aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
Diffstat (limited to 'eth/backend.go')
-rw-r--r--eth/backend.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 37fe66abf..4644b8a93 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -11,6 +11,8 @@ import (
"strings"
"time"
+ "github.com/ethereum/go-ethereum/metrics"
+
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
@@ -248,14 +250,44 @@ func New(config *Config) (*Ethereum, error) {
if err != nil {
return nil, fmt.Errorf("blockchain db err: %v", err)
}
+ if db, ok := blockDb.(*ethdb.LDBDatabase); ok {
+ db.GetTimer = metrics.NewTimer("eth/db/block/user/gets")
+ db.PutTimer = metrics.NewTimer("eth/db/block/user/puts")
+ db.MissMeter = metrics.NewMeter("eth/db/block/user/misses")
+ db.ReadMeter = metrics.NewMeter("eth/db/block/user/reads")
+ db.WriteMeter = metrics.NewMeter("eth/db/block/user/writes")
+ db.CompTimeMeter = metrics.NewMeter("eth/db/block/compact/time")
+ db.CompReadMeter = metrics.NewMeter("eth/db/block/compact/input")
+ db.CompWriteMeter = metrics.NewMeter("eth/db/block/compact/output")
+ }
stateDb, err := newdb(filepath.Join(config.DataDir, "state"))
if err != nil {
return nil, fmt.Errorf("state db err: %v", err)
}
+ if db, ok := stateDb.(*ethdb.LDBDatabase); ok {
+ db.GetTimer = metrics.NewTimer("eth/db/state/user/gets")
+ db.PutTimer = metrics.NewTimer("eth/db/state/user/puts")
+ db.MissMeter = metrics.NewMeter("eth/db/state/user/misses")
+ db.ReadMeter = metrics.NewMeter("eth/db/state/user/reads")
+ db.WriteMeter = metrics.NewMeter("eth/db/state/user/writes")
+ db.CompTimeMeter = metrics.NewMeter("eth/db/state/compact/time")
+ db.CompReadMeter = metrics.NewMeter("eth/db/state/compact/input")
+ db.CompWriteMeter = metrics.NewMeter("eth/db/state/compact/output")
+ }
extraDb, err := newdb(filepath.Join(config.DataDir, "extra"))
if err != nil {
return nil, fmt.Errorf("extra db err: %v", err)
}
+ if db, ok := extraDb.(*ethdb.LDBDatabase); ok {
+ db.GetTimer = metrics.NewTimer("eth/db/extra/user/gets")
+ db.PutTimer = metrics.NewTimer("eth/db/extra/user/puts")
+ db.MissMeter = metrics.NewMeter("eth/db/extra/user/misses")
+ db.ReadMeter = metrics.NewMeter("eth/db/extra/user/reads")
+ db.WriteMeter = metrics.NewMeter("eth/db/extra/user/writes")
+ db.CompTimeMeter = metrics.NewMeter("eth/db/extra/compact/time")
+ db.CompReadMeter = metrics.NewMeter("eth/db/extra/compact/input")
+ db.CompWriteMeter = metrics.NewMeter("eth/db/extra/compact/output")
+ }
nodeDb := filepath.Join(config.DataDir, "nodes")
// Perform database sanity checks