mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-11 17:31:35 +00:00
core: sum prefetcher + per-tx + BAL state-transition reads into state_read_ms
This commit is contained in:
parent
cd93a42b5b
commit
d611185f09
1 changed files with 18 additions and 4 deletions
|
|
@ -677,10 +677,24 @@ func (bc *BlockChain) processBlockWithAccessList(parentRoot common.Hash, block *
|
||||||
stats.DatabaseCommit = m.TrieDBCommits
|
stats.DatabaseCommit = m.TrieDBCommits
|
||||||
stats.Prefetch = m.StatePrefetch
|
stats.Prefetch = m.StatePrefetch
|
||||||
}
|
}
|
||||||
// AccountReads, StorageReads, CodeReads, AccountUpdates, StorageUpdates
|
// Read durations: sum across all three sources (per-tx execution, BAL
|
||||||
// remain zero: no wall-clock equivalent under parallel execution. Their
|
// state-transition recomputation, prefetcher async fetches). This is
|
||||||
// sum-over-tx interpretation conflicts with mgas/sec accounting, so the
|
// sum-of-CPU-time across parallel workers, not wall-clock — it can
|
||||||
// serialized-time meaning is honored only via stats.Execution.
|
// exceed TotalTime, which is the intended interpretation under parallel
|
||||||
|
// execution: "total CPU-time spent reading state across the block".
|
||||||
|
var prefetchAccountReads, prefetchStorageReads time.Duration
|
||||||
|
if pr, ok := prefetchReader.(interface {
|
||||||
|
PrefetchReadTimes() (time.Duration, time.Duration)
|
||||||
|
}); ok {
|
||||||
|
prefetchAccountReads, prefetchStorageReads = pr.PrefetchReadTimes()
|
||||||
|
}
|
||||||
|
stats.AccountReads = res.PerTxAccountReads + prefetchAccountReads
|
||||||
|
stats.StorageReads = res.PerTxStorageReads + prefetchStorageReads
|
||||||
|
stats.CodeReads = res.PerTxCodeReads
|
||||||
|
if m := res.StateTransitionMetrics; m != nil {
|
||||||
|
stats.AccountReads += m.AccountReadTime
|
||||||
|
stats.StorageReads += m.StorageReadTime
|
||||||
|
}
|
||||||
|
|
||||||
// Cache stats from the shared prefetch reader (accumulates centrally).
|
// Cache stats from the shared prefetch reader (accumulates centrally).
|
||||||
if r, ok := prefetchReader.(state.ReaderStater); ok {
|
if r, ok := prefetchReader.(state.ReaderStater); ok {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue