mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-10 01:56:37 +00:00
fix negative evm
This commit is contained in:
parent
01649de12e
commit
c8592a42a8
1 changed files with 8 additions and 1 deletions
|
|
@ -120,6 +120,13 @@ func (t *perfTracer) OnBlockStart(event tracing.BlockEvent) {
|
||||||
func (t *perfTracer) OnTxStart(vm *tracing.VMContext, tx *types.Transaction, from common.Address) {
|
func (t *perfTracer) OnTxStart(vm *tracing.VMContext, tx *types.Transaction, from common.Address) {
|
||||||
t.txStartTime = time.Now()
|
t.txStartTime = time.Now()
|
||||||
t.statedb = vm.StateDB
|
t.statedb = vm.StateDB
|
||||||
|
|
||||||
|
// The accumulated measurements include IO performed before any txs were executed.
|
||||||
|
if t.txIndex == 0 {
|
||||||
|
initialIO := t.statedb.GetAccumulatedIOMeasurements()
|
||||||
|
t.prevAccountReads = initialIO.AccountReads
|
||||||
|
t.prevStorageReads = initialIO.StorageReads
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *perfTracer) OnTxEnd(receipt *types.Receipt, err error) {
|
func (t *perfTracer) OnTxEnd(receipt *types.Receipt, err error) {
|
||||||
|
|
@ -131,7 +138,7 @@ func (t *perfTracer) OnTxEnd(receipt *types.Receipt, err error) {
|
||||||
evmTime time.Duration
|
evmTime time.Duration
|
||||||
)
|
)
|
||||||
if ioTime > totalTime {
|
if ioTime > totalTime {
|
||||||
log.Error("PerfTracer: IO time exceeds total time", "ioTime", ioTime, "totalTime", totalTime)
|
log.Error("PerfTracer: IO time exceeds total time", "ioTime", ioTime, "totalTime", totalTime, "txIdx", t.txIndex)
|
||||||
} else {
|
} else {
|
||||||
evmTime = totalTime - ioTime
|
evmTime = totalTime - ioTime
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue