Skip to content

Commit

Permalink
count exec time
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny2022da committed Aug 14, 2024
1 parent 8b884e1 commit 663aad3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error)
}
ptime := time.Since(pstart)

log.Warn("After process", "block number", block.NumberU64(), "ptime", common.PrettyDuration(ptime))
log.Warn("After process", "block number", block.NumberU64(), "txs", block.Transactions().Len(), "ptime", common.PrettyDuration(ptime))
vstart := time.Now()
if err := bc.validator.ValidateState(block, statedb, receipts, usedGas); err != nil {
bc.reportBlock(block, receipts, err)
Expand Down
6 changes: 4 additions & 2 deletions core/parallel_state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -799,10 +799,11 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat
}

dispatchTime := time.Now()

executionTime := time.Now()
// wait until all Txs have processed.
for {
if len(commonTxs) == txNum {
executionTime = time.Now()
// put it ahead of chan receive to avoid waiting for empty block
break
}
Expand Down Expand Up @@ -880,7 +881,8 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat
"InitTime", common.PrettyDuration(initialTime.Sub(procTime)),
"DagLoadTime", common.PrettyDuration(dagLoadTime.Sub(initialTime)),
"DispatchTime", common.PrettyDuration(dispatchTime.Sub(dagLoadTime)),
"resultProcessTime", common.PrettyDuration(resultProcessTime.Sub(dispatchTime)),
"ExecTime", common.PrettyDuration(executionTime.Sub(dispatchTime)),
"resultProcessTime", common.PrettyDuration(resultProcessTime.Sub(executionTime)),
"postProcessTime", common.PrettyDuration(postProcessTime.Sub(resultProcessTime)),
"wholeTime", common.PrettyDuration(postProcessTime.Sub(procTime)))

Expand Down

0 comments on commit 663aad3

Please sign in to comment.