diff --git a/trie/hasher.go b/trie/hasher.go index b6223bf32..e6261819c 100644 --- a/trie/hasher.go +++ b/trie/hasher.go @@ -60,6 +60,7 @@ func (h *hasher) hash(n node, db DatabaseWriter, force bool) (node, node, error) if n.canUnload(h.cachegen, h.cachelimit) { // Unload the node from cache. All of its subnodes will have a lower or equal // cache generation number. + cacheUnloadCounter.Inc(1) return hash, hash, nil } if !dirty { diff --git a/trie/trie.go b/trie/trie.go index 632060543..2a7bc16e4 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -35,7 +35,10 @@ var ( emptyState common.Hash ) -var cacheMissCounter = metrics.NewRegisteredCounter("trie/cachemiss", nil) +var ( + cacheMissCounter = metrics.NewRegisteredCounter("trie/cachemiss", nil) + cacheUnloadCounter = metrics.NewRegisteredCounter("trie/cacheunload", nil) +) // CacheMisses retrieves a global counter measuring the number of cache misses // the trie did since process startup. This isn't useful for anything apart from