diff --git a/trie/triedb/pathdb/asyncnodebuffer.go b/trie/triedb/pathdb/asyncnodebuffer.go index 2c96fedc02..6c988b6f6a 100644 --- a/trie/triedb/pathdb/asyncnodebuffer.go +++ b/trie/triedb/pathdb/asyncnodebuffer.go @@ -272,6 +272,7 @@ func (nc *nodecache) commit(nodes map[common.Hash]map[string]*trienode.Node) err } nc.updateSize(delta) nc.layers++ + frontBufferDeltaMeter.Mark(delta) gcNodesMeter.Mark(overwrite) gcBytesMeter.Mark(overwriteSize) return nil @@ -321,6 +322,7 @@ func (nc *nodecache) flush(db ethdb.KeyValueStore, clean *fastcache.Cache, id ui if err := batch.Write(); err != nil { return err } + backCommitlayerNumberMeter.Update(int64(nc.layers)) commitBytesMeter.Mark(int64(size)) commitNodesMeter.Mark(int64(nodes)) commitTimeTimer.UpdateSince(start) diff --git a/trie/triedb/pathdb/layertree.go b/trie/triedb/pathdb/layertree.go index ed94d2e19e..9d495741b1 100644 --- a/trie/triedb/pathdb/layertree.go +++ b/trie/triedb/pathdb/layertree.go @@ -191,6 +191,7 @@ func (tree *layerTree) cap(root common.Hash, layers int) error { remove(root) } } + layerNumberMeter.Update(int64(len(tree.layers))) return nil } diff --git a/trie/triedb/pathdb/metrics.go b/trie/triedb/pathdb/metrics.go index 9e2b1dcbf5..bb8cb45b08 100644 --- a/trie/triedb/pathdb/metrics.go +++ b/trie/triedb/pathdb/metrics.go @@ -47,4 +47,8 @@ var ( historyBuildTimeMeter = metrics.NewRegisteredTimer("pathdb/history/time", nil) historyDataBytesMeter = metrics.NewRegisteredMeter("pathdb/history/bytes/data", nil) historyIndexBytesMeter = metrics.NewRegisteredMeter("pathdb/history/bytes/index", nil) + + layerNumberMeter = metrics.NewRegisteredGauge("pathdb/layer/number", nil) + frontBufferDeltaMeter = metrics.NewRegisteredMeter("pathdb/front/buffer/delta", nil) + backCommitlayerNumberMeter = metrics.NewRegisteredGauge("pathdb/back/commit/layer/number", nil) )