@@ -47,7 +47,10 @@ import (
47
47
)
48
48
49
49
var (
50
- blockInsertTimer = metrics .NewRegisteredTimer ("chain/inserts" , nil )
50
+ blockInsertTimer = metrics .NewRegisteredTimer ("chain/inserts" , nil )
51
+ blockValidationTimer = metrics .NewRegisteredTimer ("chain/validation" , nil )
52
+ blockExecutionTimer = metrics .NewRegisteredTimer ("chain/execution" , nil )
53
+ blockWriteTimer = metrics .NewRegisteredTimer ("chain/write" , nil )
51
54
52
55
ErrNoGenesis = errors .New ("Genesis not found in chain" )
53
56
)
@@ -1188,7 +1191,9 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, []
1188
1191
return it .index , events , coalescedLogs , err
1189
1192
}
1190
1193
// Process block using the parent state as reference point.
1194
+ t0 := time .Now ()
1191
1195
receipts , logs , usedGas , err := bc .processor .Process (block , state , bc .vmConfig )
1196
+ t1 := time .Now ()
1192
1197
if err != nil {
1193
1198
bc .reportBlock (block , receipts , err )
1194
1199
return it .index , events , coalescedLogs , err
@@ -1198,13 +1203,19 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, []
1198
1203
bc .reportBlock (block , receipts , err )
1199
1204
return it .index , events , coalescedLogs , err
1200
1205
}
1206
+ t2 := time .Now ()
1201
1207
proctime := time .Since (start )
1202
1208
1203
1209
// Write the block to the chain and get the status.
1204
1210
status , err := bc .WriteBlockWithState (block , receipts , state )
1211
+ t3 := time .Now ()
1205
1212
if err != nil {
1206
1213
return it .index , events , coalescedLogs , err
1207
1214
}
1215
+ blockInsertTimer .UpdateSince (start )
1216
+ blockExecutionTimer .Update (t1 .Sub (t0 ))
1217
+ blockValidationTimer .Update (t2 .Sub (t1 ))
1218
+ blockWriteTimer .Update (t3 .Sub (t2 ))
1208
1219
switch status {
1209
1220
case CanonStatTy :
1210
1221
log .Debug ("Inserted new block" , "number" , block .Number (), "hash" , block .Hash (),
0 commit comments