From 4ed6b8e36f13e27105e18bea971269feaf733389 Mon Sep 17 00:00:00 2001 From: joeycli Date: Mon, 2 Sep 2024 09:08:55 +0800 Subject: [PATCH] chore: add execute, verify and commit total metrics --- core/blockchain.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index de119db2c..8cf344485 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -92,10 +92,13 @@ var ( triedbCommitTimer = metrics.NewRegisteredTimer("chain/triedb/commits", nil) - blockInsertTimer = metrics.NewRegisteredTimer("chain/inserts", nil) - blockValidationTimer = metrics.NewRegisteredTimer("chain/validation", nil) - blockExecutionTimer = metrics.NewRegisteredTimer("chain/execution", nil) - blockWriteTimer = metrics.NewRegisteredTimer("chain/write", nil) + blockInsertTimer = metrics.NewRegisteredTimer("chain/inserts", nil) + blockValidationTimer = metrics.NewRegisteredTimer("chain/validation", nil) + blockExecutionTimer = metrics.NewRegisteredTimer("chain/execution", nil) + blockWriteTimer = metrics.NewRegisteredTimer("chain/write", nil) + blockValidationTotalTimer = metrics.NewRegisteredTimer("chain/total/validation", nil) + blockExecutionTotalTimer = metrics.NewRegisteredTimer("chain/total/execution", nil) + blockWriteTotalTimer = metrics.NewRegisteredTimer("chain/total/write", nil) blockReorgMeter = metrics.NewRegisteredMeter("chain/reorg/executes", nil) blockReorgAddMeter = metrics.NewRegisteredMeter("chain/reorg/add", nil) @@ -2307,6 +2310,8 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) statedb.StopPrefetcher() return it.index, err } + blockExecutionTotalTimer.UpdateSince(pstart) + ptime := time.Since(pstart) // Validate the state using the default validator @@ -2317,6 +2322,8 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) statedb.StopPrefetcher() return it.index, err } + blockValidationTotalTimer.UpdateSince(vstart) + vtime := time.Since(vstart) proctime := time.Since(start) // processing + validation @@ -2352,6 +2359,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) return it.index, err } bc.stateCache.Release() + blockWriteTotalTimer.UpdateSince(wstart) bc.cacheReceipts(block.Hash(), receipts, block)