Skip to content

core: extend the code reader statistics - #33659

Merged
gballet merged 2 commits into
ethereum:masterfrom
rjl493456442:add-code-readbytes
Jan 26, 2026
Merged

core: extend the code reader statistics#33659
gballet merged 2 commits into
ethereum:masterfrom
rjl493456442:add-code-readbytes

Conversation

@rjl493456442

@rjl493456442 rjl493456442 commented Jan 22, 2026

Copy link
Copy Markdown
Member

This PR extends the statistics of contract code read by adding these fields:

  • CacheHitBytes: the total number of bytes served by cache
  • CacheMissBytes: the total number of bytes read on cache miss
  • CodeReadBytes: the total number of bytes for contract code read

@rjl493456442

Copy link
Copy Markdown
Member Author
INFO [01-22|03:10:50.102] Block: 24287552 (0x84944572eea358ded7c608829e39cc985138fb634502e78347ad7379ffb71576) txs: 330, mgasps: 254.54, elapsed: 100.077ms
INFO [01-22|03:10:50.102] EVM execution: 78.187ms
INFO [01-22|03:10:50.102] Validation: 7.386ms
INFO [01-22|03:10:50.102]     Account hash: 3.250ms
INFO [01-22|03:10:50.102]     Storage hash: 2.570ms
INFO [01-22|03:10:50.102] State read: 4.925ms
INFO [01-22|03:10:50.102]     Account read: 3.853ms(906)
INFO [01-22|03:10:50.102] "    Storage read: 831.365µs(1649)"
INFO [01-22|03:10:50.102] "    Code read: 240.961µs(359 2.49 MiB)"
INFO [01-22|03:10:50.102] State write: 9.530ms
INFO [01-22|03:10:50.102]     Trie commit: 2.353ms
INFO [01-22|03:10:50.102]     State write: 5.527ms
INFO [01-22|03:10:50.102]     Block write: 1.649ms
INFO [01-22|03:10:50.102] Reader statistics
INFO [01-22|03:10:50.102] account: hit: 899, miss: 7, rate: 99.23
INFO [01-22|03:10:50.102] storage: hit: 1632, miss: 17, rate: 98.97
INFO [01-22|03:10:50.102] code: hit: 359(2.97 MiB), miss: 0(0.00 B), rate: 1.00

Comment thread core/blockchain.go
storageUpdateTimer = metrics.NewRegisteredResettingTimer("chain/storage/updates", nil)
storageCommitTimer = metrics.NewRegisteredResettingTimer("chain/storage/commits", nil)
codeReadTimer = metrics.NewRegisteredResettingTimer("chain/code/reads", nil)
codeReadBytesTimer = metrics.NewRegisteredResettingTimer("chain/code/readbytes", nil)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an ugly hack.

We should implement a generalized Resetting Meter.

@gballet gballet added this to the 1.17.0 milestone Jan 26, 2026
@gballet
gballet merged commit c259538 into ethereum:master Jan 26, 2026
7 of 8 checks passed
gballet pushed a commit to BZO95/go-ethereum that referenced this pull request May 21, 2026
This PR extends the statistics of contract code read by adding these
fields:

- **CacheHitBytes**: the total number of bytes served by cache
- **CacheMissBytes**: the total number of bytes read on cache miss
- **CodeReadBytes**: the total number of bytes for contract code read
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants