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. // ExecuteStats includes all the statistics of a block execution in details.
type ExecuteStats struct { 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 AccountReads time.Duration // Time spent on the account reads
StorageReads time.Duration // Time spent on the storage reads StorageReads time.Duration // Time spent on the storage reads
AccountHashes time.Duration // Time spent on the account trie hash 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 // GetStateStats forwards stats from the wrapped *stateReaderWithStats so the
// reader-aggregator type assertion at reader.go:553 succeeds. Without this, // (*reader).GetStateStats type assertion succeeds. Without this, account/
// account/storage cache hit/miss counts emit zero on BAL blocks. // storage cache hit/miss counts emit zero on BAL blocks.
func (r *prefetchStateReader) GetStateStats() StateReaderStats { func (r *prefetchStateReader) GetStateStats() StateReaderStats {
if stater, ok := r.StateReader.(StateReaderStater); ok { if stater, ok := r.StateReader.(StateReaderStater); ok {
return stater.GetStateStats() return stater.GetStateStats()