core: tighten metric doc comments

- Replace reader.go:553 line citation in GetStateStats with the function
  name; line numbers rot.
- Note the BAL sum-of-CPU-time semantics on the read-time field group
  in ExecuteStats so cross-client consumers don't read total ≤ TotalTime
  as an invariant.
This commit is contained in:
CPerezz 2026-05-01 00:38:31 +02:00
parent 13733390da
commit 8797d1af8e
No known key found for this signature in database
GPG key ID: 62045F34B97177DD
2 changed files with 5 additions and 3 deletions

View file

@ -28,7 +28,9 @@ import (
// ExecuteStats includes all the statistics of a block execution in details.
type ExecuteStats struct {
// State read times
// State read times. For BAL blocks these are sum-of-CPU-time across
// per-tx, pre-tx, post-tx, BAL state-transition and prefetcher paths;
// can exceed TotalTime by design. Sequential blocks: wall-clock.
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

View file

@ -375,8 +375,8 @@ func (r *readerTracker) TouchStorage(addr common.Address, slot common.Hash) {
}
// GetStateStats forwards stats from the wrapped *stateReaderWithStats so the
// reader-aggregator type assertion at reader.go:553 succeeds. Without this,
// account/storage cache hit/miss counts emit zero on BAL blocks.
// (*reader).GetStateStats type assertion succeeds. Without this, account/
// storage cache hit/miss counts emit zero on BAL blocks.
func (r *prefetchStateReader) GetStateStats() StateReaderStats {
if stater, ok := r.StateReader.(StateReaderStater); ok {
return stater.GetStateStats()