mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-01 00:53:47 +00:00
Expose IO measurements from statedb
This commit is contained in:
parent
4278dab145
commit
0fc0b407f7
4 changed files with 38 additions and 0 deletions
|
|
@ -1434,3 +1434,17 @@ func (s *StateDB) Witness() *stateless.Witness {
|
|||
func (s *StateDB) AccessEvents() *AccessEvents {
|
||||
return s.accessEvents
|
||||
}
|
||||
|
||||
func (s *StateDB) GetAccumulatedIOMeasurements() *tracing.IOMeasurements {
|
||||
return &tracing.IOMeasurements{
|
||||
AccountReads: s.AccountReads,
|
||||
AccountHashes: s.AccountHashes,
|
||||
AccountUpdates: s.AccountUpdates,
|
||||
AccountCommits: s.AccountCommits,
|
||||
StorageReads: s.StorageReads,
|
||||
StorageUpdates: s.StorageUpdates,
|
||||
StorageCommits: s.StorageCommits,
|
||||
SnapshotCommits: s.SnapshotCommits,
|
||||
TrieDBCommits: s.TrieDBCommits,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,3 +276,7 @@ func (s *hookedStateDB) Finalise(deleteEmptyObjects bool) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *hookedStateDB) GetAccumulatedIOMeasurements() *tracing.IOMeasurements {
|
||||
return s.inner.GetAccumulatedIOMeasurements()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ package tracing
|
|||
|
||||
import (
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
|
|
@ -55,6 +56,21 @@ type StateDB interface {
|
|||
GetTransientState(common.Address, common.Hash) common.Hash
|
||||
Exist(common.Address) bool
|
||||
GetRefund() uint64
|
||||
GetAccumulatedIOMeasurements() *IOMeasurements
|
||||
}
|
||||
|
||||
// IOMeasurements is a struct that contains the measurements of
|
||||
// the I/O operations performed by the statedb.
|
||||
type IOMeasurements struct {
|
||||
AccountReads time.Duration
|
||||
AccountHashes time.Duration
|
||||
AccountUpdates time.Duration
|
||||
AccountCommits time.Duration
|
||||
StorageReads time.Duration
|
||||
StorageUpdates time.Duration
|
||||
StorageCommits time.Duration
|
||||
SnapshotCommits time.Duration
|
||||
TrieDBCommits time.Duration
|
||||
}
|
||||
|
||||
// VMContext provides the context for the EVM execution.
|
||||
|
|
|
|||
|
|
@ -101,4 +101,8 @@ type StateDB interface {
|
|||
|
||||
// Finalise must be invoked at the end of a transaction
|
||||
Finalise(bool)
|
||||
|
||||
// GetAccumulatedGasMeasurements returns measurements of IO operations that have
|
||||
// been accumulated since the execution of the block started.
|
||||
GetAccumulatedIOMeasurements() *tracing.IOMeasurements
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue