Skip to content

Commit 97b516b

Browse files
committed
core: track account trie wait
1 parent c6b2a6c commit 97b516b

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

core/blockchain.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,6 +2158,7 @@ func (bc *BlockChain) ProcessBlock(parentRoot common.Hash, block *types.Block, s
21582158
stats.AccountReads = statedb.AccountReads // Account reads are complete(in processing)
21592159
stats.StorageReads = statedb.StorageReads // Storage reads are complete(in processing)
21602160
stats.AccountUpdates = statedb.AccountUpdates // Account updates are complete(in validation)
2161+
stats.AccountUpdateWait = statedb.AccountUpdateWait
21612162
stats.StorageUpdates = statedb.StorageUpdates // Storage updates are complete(in validation)
21622163
stats.AccountHashes = statedb.AccountHashes // Account hashes are complete(in validation)
21632164

core/blockchain_stats.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ import (
3030
// ExecuteStats includes all the statistics of a block execution in details.
3131
type ExecuteStats struct {
3232
// State read times
33-
AccountReads time.Duration // Time spent on the account reads
34-
StorageReads time.Duration // Time spent on the storage reads
35-
AccountHashes time.Duration // Time spent on the account trie hash
36-
AccountUpdates time.Duration // Time spent on the account trie update
37-
AccountCommits time.Duration // Time spent on the account trie commit
38-
StorageUpdates time.Duration // Time spent on the storage trie update
39-
StorageCommits time.Duration // Time spent on the storage trie commit
33+
AccountReads time.Duration // Time spent on the account reads
34+
StorageReads time.Duration // Time spent on the storage reads
35+
AccountHashes time.Duration // Time spent on the account trie hash
36+
AccountUpdates time.Duration // Time spent on the account trie update
37+
AccountUpdateWait time.Duration // Time spent on waiting the account trie from prefetching
38+
AccountCommits time.Duration // Time spent on the account trie commit
39+
StorageUpdates time.Duration // Time spent on the storage trie update
40+
StorageCommits time.Duration // Time spent on the storage trie commit
4041

4142
AccountLoaded int // Number of accounts loaded
4243
AccountUpdated int // Number of accounts updated
@@ -114,7 +115,7 @@ EVM execution: %v
114115
Validation: %v
115116
Account read: %v(%d)
116117
Storage read: %v(%d)
117-
Account hash: %v
118+
Account hash: %v(wait=%v)
118119
Storage hash: %v
119120
DB commit: %v
120121
Block write: %v
@@ -126,7 +127,7 @@ Total: %v
126127
common.PrettyDuration(s.Execution), common.PrettyDuration(s.Validation+s.CrossValidation),
127128
common.PrettyDuration(s.AccountReads), s.AccountLoaded,
128129
common.PrettyDuration(s.StorageReads), s.StorageLoaded,
129-
common.PrettyDuration(s.AccountHashes+s.AccountCommits+s.AccountUpdates),
130+
common.PrettyDuration(s.AccountHashes+s.AccountCommits+s.AccountUpdates), common.PrettyDuration(s.AccountUpdateWait),
130131
common.PrettyDuration(s.StorageCommits+s.StorageUpdates),
131132
common.PrettyDuration(s.TrieDBCommit+s.SnapshotCommit), common.PrettyDuration(s.BlockWrite),
132133
common.PrettyDuration(s.TotalTime), s.StateReadCacheStats)

core/state/statedb.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,12 @@ type StateDB struct {
140140
witnessStats *stateless.WitnessStats
141141

142142
// Measurements gathered during execution for debugging purposes
143-
AccountReads time.Duration
144-
AccountHashes time.Duration
145-
AccountUpdates time.Duration
146-
AccountCommits time.Duration
143+
AccountReads time.Duration
144+
AccountHashes time.Duration
145+
AccountUpdates time.Duration
146+
AccountCommits time.Duration
147+
AccountUpdateWait time.Duration
148+
147149
StorageReads time.Duration
148150
StorageUpdates time.Duration
149151
StorageCommits time.Duration
@@ -915,6 +917,7 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
915917
} else {
916918
s.trie = trie
917919
}
920+
s.AccountUpdateWait += time.Since(start)
918921
}
919922
// Perform updates before deletions. This prevents resolution of unnecessary trie nodes
920923
// in circumstances similar to the following:

0 commit comments

Comments
 (0)