forked from cerc-io/plugeth
cmd/geth, trie: report on trie cache unloads, also add debug log
This commit is contained in:
parent
5d9bb0a050
commit
88a593d559
@ -99,7 +99,8 @@ func importChain(ctx *cli.Context) error {
|
|||||||
utils.Fatalf("Failed to read database stats: %v", err)
|
utils.Fatalf("Failed to read database stats: %v", err)
|
||||||
}
|
}
|
||||||
fmt.Println(stats)
|
fmt.Println(stats)
|
||||||
fmt.Printf("Trie cache misses: %d\n\n", trie.CacheMisses())
|
fmt.Printf("Trie cache misses: %d\n", trie.CacheMisses())
|
||||||
|
fmt.Printf("Trie cache unloads: %d\n\n", trie.CacheUnloads())
|
||||||
|
|
||||||
// Compact the entire database to more accurately measure disk io and print the stats
|
// Compact the entire database to more accurately measure disk io and print the stats
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
|
@ -564,6 +564,8 @@ func (s *StateDB) Commit() (root common.Hash, err error) {
|
|||||||
func (s *StateDB) CommitBatch() (root common.Hash, batch ethdb.Batch) {
|
func (s *StateDB) CommitBatch() (root common.Hash, batch ethdb.Batch) {
|
||||||
batch = s.db.NewBatch()
|
batch = s.db.NewBatch()
|
||||||
root, _ = s.commit(batch)
|
root, _ = s.commit(batch)
|
||||||
|
|
||||||
|
glog.V(logger.Debug).Infof("Trie cache stats: %d misses, %d unloads", trie.CacheMisses(), trie.CacheUnloads())
|
||||||
return root, batch
|
return root, batch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,13 @@ func CacheMisses() int64 {
|
|||||||
return cacheMissCounter.Count()
|
return cacheMissCounter.Count()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CacheUnloads retrieves a global counter measuring the number of cache unloads
|
||||||
|
// the trie did since process startup. This isn't useful for anything apart from
|
||||||
|
// trie debugging purposes.
|
||||||
|
func CacheUnloads() int64 {
|
||||||
|
return cacheUnloadCounter.Count()
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
sha3.NewKeccak256().Sum(emptyState[:0])
|
sha3.NewKeccak256().Sum(emptyState[:0])
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user