Skip to content

Commit e5098e9

Browse files
committed
core: improve mgasps meter
1 parent f1eee7f commit e5098e9

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

core/blockchain.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ var (
6666
headSafeBlockGauge = metrics.NewRegisteredGauge("chain/head/safe", nil)
6767

6868
chainInfoGauge = metrics.NewRegisteredGaugeInfo("chain/info", nil)
69-
chainMgaspsGauge = metrics.NewRegisteredGauge("chain/mgasps", nil)
70-
chainGasCounter = metrics.NewRegisteredCounter("chain/gas/total", nil)
69+
chainMgaspsMeter = metrics.NewRegisteredMeter("chain/mgasps", nil)
7170

7271
accountReadTimer = metrics.NewRegisteredResettingTimer("chain/account/reads", nil)
7372
accountHashTimer = metrics.NewRegisteredResettingTimer("chain/account/hashes", nil)
@@ -1845,7 +1844,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool, makeWitness
18451844
// Report the import stats before returning the various results
18461845
stats.processed++
18471846
stats.usedGas += res.usedGas
1848-
chainGasCounter.Inc(int64(res.usedGas))
18491847
witness = res.witness
18501848

18511849
var snapDiffItems, snapBufItems common.StorageSize
@@ -2070,6 +2068,7 @@ func (bc *BlockChain) processBlock(parentRoot common.Hash, block *types.Block, s
20702068

20712069
blockWriteTimer.Update(time.Since(wstart) - max(statedb.AccountCommits, statedb.StorageCommits) /* concurrent */ - statedb.SnapshotCommits - statedb.TrieDBCommits)
20722070
blockInsertTimer.UpdateSince(startTime)
2071+
chainMgaspsMeter.Mark(int64(float64(res.GasUsed) / 1000_000))
20732072

20742073
return &blockProcessingResult{
20752074
usedGas: res.GasUsed,

core/blockchain_insert.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ func (st *insertStats) report(chain []*types.Block, index int, snapDiffItems, sn
4646
elapsed = now.Sub(st.startTime) + 1 // prevent zero division
4747
mgasps = float64(st.usedGas) * 1000 / float64(elapsed)
4848
)
49-
// Update the Mgas per second gauge
50-
chainMgaspsGauge.Update(int64(mgasps))
51-
5249
// If we're at the last block of the batch or report period reached, log
5350
if index == len(chain)-1 || elapsed >= statsReportLimit {
5451
// Count the number of transactions in this segment

0 commit comments

Comments
 (0)