mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
cmd/evm: resolve conflict in evm benchmarking
This commit is contained in:
parent
c0d0b1cb06
commit
6f42b5a43e
1 changed files with 7 additions and 15 deletions
|
|
@ -106,21 +106,13 @@ func timedExec(bench bool, execFunc func() ([]byte, uint64, error)) ([]byte, exe
|
||||||
})
|
})
|
||||||
// Get the average execution time from the benchmarking result.
|
// Get the average execution time from the benchmarking result.
|
||||||
// There are other useful stats here that could be reported.
|
// There are other useful stats here that could be reported.
|
||||||
stats.time = time.Duration(result.NsPerOp())
|
stats := execStats{
|
||||||
stats.allocs = result.AllocsPerOp()
|
Time: time.Duration(result.NsPerOp()),
|
||||||
stats.bytesAllocated = result.AllocedBytesPerOp()
|
Allocs: result.AllocsPerOp(),
|
||||||
} else {
|
BytesAllocated: result.AllocedBytesPerOp(),
|
||||||
var memStatsBefore, memStatsAfter goruntime.MemStats
|
GasUsed: gasUsed,
|
||||||
|
}
|
||||||
goruntime.ReadMemStats(&memStatsBefore)
|
return output, stats, err
|
||||||
|
|
||||||
startTime := time.Now()
|
|
||||||
output, gasLeft, err = execFunc()
|
|
||||||
stats.time = time.Since(startTime)
|
|
||||||
|
|
||||||
goruntime.ReadMemStats(&memStatsAfter)
|
|
||||||
stats.allocs = int64(memStatsAfter.Mallocs - memStatsBefore.Mallocs)
|
|
||||||
stats.bytesAllocated = int64(memStatsAfter.TotalAlloc - memStatsBefore.TotalAlloc)
|
|
||||||
}
|
}
|
||||||
var memStatsBefore, memStatsAfter goruntime.MemStats
|
var memStatsBefore, memStatsAfter goruntime.MemStats
|
||||||
goruntime.ReadMemStats(&memStatsBefore)
|
goruntime.ReadMemStats(&memStatsBefore)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue