@@ -1752,44 +1752,45 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool)
1752
1752
}
1753
1753
1754
1754
// Process block using the parent state as reference point
1755
- substart := time .Now ()
1755
+ pstart := time .Now ()
1756
1756
receipts , logs , usedGas , err := bc .processor .Process (block , statedb , bc .vmConfig )
1757
1757
if err != nil {
1758
1758
bc .reportBlock (block , receipts , err )
1759
1759
atomic .StoreUint32 (& followupInterrupt , 1 )
1760
1760
return it .index , err
1761
1761
}
1762
+ ptime := time .Since (pstart )
1762
1763
1763
- // Update the metrics touched during block processing
1764
- accountReadTimer .Update (statedb .AccountReads ) // Account reads are complete, we can mark them
1765
- storageReadTimer .Update (statedb .StorageReads ) // Storage reads are complete, we can mark them
1766
- accountUpdateTimer .Update (statedb .AccountUpdates ) // Account updates are complete, we can mark them
1767
- storageUpdateTimer .Update (statedb .StorageUpdates ) // Storage updates are complete, we can mark them
1768
- snapshotAccountReadTimer .Update (statedb .SnapshotAccountReads ) // Account reads are complete, we can mark them
1769
- snapshotStorageReadTimer .Update (statedb .SnapshotStorageReads ) // Storage reads are complete, we can mark them
1770
- triehash := statedb .AccountHashes + statedb .StorageHashes // Save to not double count in validation
1771
- trieproc := statedb .SnapshotAccountReads + statedb .AccountReads + statedb .AccountUpdates
1772
- trieproc += statedb .SnapshotStorageReads + statedb .StorageReads + statedb .StorageUpdates
1773
-
1774
- blockExecutionTimer .Update (time .Since (substart ) - trieproc - triehash )
1775
-
1776
- // Validate the state using the default validator
1777
- substart = time .Now ()
1764
+ vstart := time .Now ()
1778
1765
if err := bc .validator .ValidateState (block , statedb , receipts , usedGas ); err != nil {
1779
1766
bc .reportBlock (block , receipts , err )
1780
1767
atomic .StoreUint32 (& followupInterrupt , 1 )
1781
1768
return it .index , err
1782
1769
}
1783
- proctime := time .Since (start )
1784
-
1785
- // Update the metrics touched during block validation
1786
- accountHashTimer .Update (statedb .AccountHashes ) // Account hashes are complete, we can mark them
1787
- storageHashTimer .Update (statedb .StorageHashes ) // Storage hashes are complete, we can mark them
1788
- blockValidationTimer .Update (time .Since (substart ) - (statedb .AccountHashes + statedb .StorageHashes - triehash ))
1770
+ vtime := time .Since (vstart )
1771
+ proctime := time .Since (start ) // processing + validation
1772
+
1773
+ // Update the metrics touched during block processing and validation
1774
+ accountReadTimer .Update (statedb .AccountReads ) // Account reads are complete(in processing)
1775
+ storageReadTimer .Update (statedb .StorageReads ) // Storage reads are complete(in processing)
1776
+ snapshotAccountReadTimer .Update (statedb .SnapshotAccountReads ) // Account reads are complete(in processing)
1777
+ snapshotStorageReadTimer .Update (statedb .SnapshotStorageReads ) // Storage reads are complete(in processing)
1778
+ accountUpdateTimer .Update (statedb .AccountUpdates ) // Account updates are complete(in validation)
1779
+ storageUpdateTimer .Update (statedb .StorageUpdates ) // Storage updates are complete(in validation)
1780
+ accountHashTimer .Update (statedb .AccountHashes ) // Account hashes are complete(in validation)
1781
+ storageHashTimer .Update (statedb .StorageHashes ) // Storage hashes are complete(in validation)
1782
+ triehash := statedb .AccountHashes + statedb .StorageHashes // The time spent on tries hashing
1783
+ trieUpdate := statedb .AccountUpdates + statedb .StorageUpdates // The time spent on tries update
1784
+ trieRead := statedb .SnapshotAccountReads + statedb .AccountReads // The time spent on account read
1785
+ trieRead += statedb .SnapshotStorageReads + statedb .StorageReads // The time spent on storage read
1786
+ blockExecutionTimer .Update (ptime - trieRead ) // The time spent on EVM processing
1787
+ blockValidationTimer .Update (vtime - (triehash + trieUpdate )) // The time spent on block validation
1789
1788
1790
1789
// Write the block to the chain and get the status.
1791
- substart = time .Now ()
1792
- var status WriteStatus
1790
+ var (
1791
+ wstart = time .Now ()
1792
+ status WriteStatus
1793
+ )
1793
1794
if ! setHead {
1794
1795
// Don't set the head, only insert the block
1795
1796
err = bc .writeBlockWithState (block , receipts , statedb )
@@ -1804,9 +1805,9 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool)
1804
1805
accountCommitTimer .Update (statedb .AccountCommits ) // Account commits are complete, we can mark them
1805
1806
storageCommitTimer .Update (statedb .StorageCommits ) // Storage commits are complete, we can mark them
1806
1807
snapshotCommitTimer .Update (statedb .SnapshotCommits ) // Snapshot commits are complete, we can mark them
1807
- triedbCommitTimer .Update (statedb .TrieDBCommits ) // Triedb commits are complete, we can mark them
1808
+ triedbCommitTimer .Update (statedb .TrieDBCommits ) // Trie database commits are complete, we can mark them
1808
1809
1809
- blockWriteTimer .Update (time .Since (substart ) - statedb .AccountCommits - statedb .StorageCommits - statedb .SnapshotCommits - statedb .TrieDBCommits )
1810
+ blockWriteTimer .Update (time .Since (wstart ) - statedb .AccountCommits - statedb .StorageCommits - statedb .SnapshotCommits - statedb .TrieDBCommits )
1810
1811
blockInsertTimer .UpdateSince (start )
1811
1812
1812
1813
// Report the import stats before returning the various results
0 commit comments