core: changes mgasps to a speed rating

Speed is relative to the maximum speed of the blockchain in gas:
1 speed = 8Mgas/block * 1 block/13s ~= .615 Mgas

This speed provides an easy way to understand how fast blocks are being processed.
This commit is contained in:
Dennis E 2018-11-25 19:02:30 -08:00
parent 2a113f6d72
commit 51a6100156

View file

@ -55,9 +55,10 @@ func (st *insertStats) report(chain []*types.Block, index int, cache common.Stor
end := chain[index] end := chain[index]
// Assemble the log context and send it to the logger // Assemble the log context and send it to the logger
sp := float64(st.usedGas) * 1000 / float64(elapsed) * 13 / 8 // ~13s/blk / max 8Mgas/blk = blk/s @ max gas
context := []interface{}{ context := []interface{}{
"blocks", st.processed, "txs", txs, "mgas", float64(st.usedGas) / 1000000, "blocks", st.processed, "txs", txs, "mgas", float64(st.usedGas) / 1000000,
"elapsed", common.PrettyDuration(elapsed), "mgasps", float64(st.usedGas) * 1000 / float64(elapsed), "elapsed", common.PrettyDuration(elapsed), "speed", sp,
"number", end.Number(), "hash", end.Hash(), "number", end.Number(), "hash", end.Hash(),
} }
if timestamp := time.Unix(end.Time().Int64(), 0); time.Since(timestamp) > time.Minute { if timestamp := time.Unix(end.Time().Int64(), 0); time.Since(timestamp) > time.Minute {