Skip to content

Commit

Permalink
trie: add metric to track cache unloading (ethereum#3175)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl authored Oct 19, 2016
1 parent 8048f4d commit 5d9bb0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions trie/hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion trie/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5d9bb0a

Please sign in to comment.