diff --git a/core/blockchain.go b/core/blockchain.go index b9ffd8283e..8c6c144515 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -2158,6 +2158,7 @@ func (bc *BlockChain) ProcessBlock(parentRoot common.Hash, block *types.Block, s stats.AccountReads = statedb.AccountReads // Account reads are complete(in processing) stats.StorageReads = statedb.StorageReads // Storage reads are complete(in processing) stats.AccountUpdates = statedb.AccountUpdates // Account updates are complete(in validation) + stats.AccountUpdateWait = statedb.AccountUpdateWait stats.StorageUpdates = statedb.StorageUpdates // Storage updates are complete(in validation) stats.AccountHashes = statedb.AccountHashes // Account hashes are complete(in validation) diff --git a/core/blockchain_stats.go b/core/blockchain_stats.go index 58726895e5..c0b01c4555 100644 --- a/core/blockchain_stats.go +++ b/core/blockchain_stats.go @@ -30,13 +30,14 @@ import ( // ExecuteStats includes all the statistics of a block execution in details. type ExecuteStats struct { // State read times - AccountReads time.Duration // Time spent on the account reads - StorageReads time.Duration // Time spent on the storage reads - AccountHashes time.Duration // Time spent on the account trie hash - AccountUpdates time.Duration // Time spent on the account trie update - AccountCommits time.Duration // Time spent on the account trie commit - StorageUpdates time.Duration // Time spent on the storage trie update - StorageCommits time.Duration // Time spent on the storage trie commit + AccountReads time.Duration // Time spent on the account reads + StorageReads time.Duration // Time spent on the storage reads + AccountHashes time.Duration // Time spent on the account trie hash + AccountUpdates time.Duration // Time spent on the account trie update + AccountUpdateWait time.Duration // Time spent on waiting the account trie from prefetching + AccountCommits time.Duration // Time spent on the account trie commit + StorageUpdates time.Duration // Time spent on the storage trie update + StorageCommits time.Duration // Time spent on the storage trie commit AccountLoaded int // Number of accounts loaded AccountUpdated int // Number of accounts updated @@ -114,7 +115,7 @@ EVM execution: %v Validation: %v Account read: %v(%d) Storage read: %v(%d) -Account hash: %v +Account hash: %v(wait=%v) Storage hash: %v DB commit: %v Block write: %v @@ -126,7 +127,7 @@ Total: %v common.PrettyDuration(s.Execution), common.PrettyDuration(s.Validation+s.CrossValidation), common.PrettyDuration(s.AccountReads), s.AccountLoaded, common.PrettyDuration(s.StorageReads), s.StorageLoaded, - common.PrettyDuration(s.AccountHashes+s.AccountCommits+s.AccountUpdates), + common.PrettyDuration(s.AccountHashes+s.AccountCommits+s.AccountUpdates), common.PrettyDuration(s.AccountUpdateWait), common.PrettyDuration(s.StorageCommits+s.StorageUpdates), common.PrettyDuration(s.TrieDBCommit+s.SnapshotCommit), common.PrettyDuration(s.BlockWrite), common.PrettyDuration(s.TotalTime), s.StateReadCacheStats) diff --git a/core/state/statedb.go b/core/state/statedb.go index b770698255..495d097c90 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -140,10 +140,12 @@ type StateDB struct { witnessStats *stateless.WitnessStats // Measurements gathered during execution for debugging purposes - AccountReads time.Duration - AccountHashes time.Duration - AccountUpdates time.Duration - AccountCommits time.Duration + AccountReads time.Duration + AccountHashes time.Duration + AccountUpdates time.Duration + AccountCommits time.Duration + AccountUpdateWait time.Duration + StorageReads time.Duration StorageUpdates time.Duration StorageCommits time.Duration @@ -915,6 +917,7 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash { } else { s.trie = trie } + s.AccountUpdateWait += time.Since(start) } // Perform updates before deletions. This prevents resolution of unnecessary trie nodes // in circumstances similar to the following: