@@ -1896,8 +1896,9 @@ static unsigned int GetBlockScriptFlags(const CBlockIndex& block_index, const Co
1896
1896
1897
1897
static int64_t nTimeCheck = 0 ;
1898
1898
static int64_t nTimeForks = 0 ;
1899
- static int64_t nTimeVerify = 0 ;
1900
1899
static int64_t nTimeConnect = 0 ;
1900
+ static int64_t nTimeVerify = 0 ;
1901
+ static int64_t nTimeUndo = 0 ;
1901
1902
static int64_t nTimeIndex = 0 ;
1902
1903
static int64_t nTimeTotal = 0 ;
1903
1904
static int64_t nBlocksTotal = 0 ;
@@ -2191,6 +2192,9 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
2191
2192
return false ;
2192
2193
}
2193
2194
2195
+ int64_t nTime5 = GetTimeMicros (); nTimeUndo += nTime5 - nTime4;
2196
+ LogPrint (BCLog::BENCH, " - Write undo data: %.2fms [%.2fs (%.2fms/blk)]\n " , MILLI * (nTime5 - nTime4), nTimeUndo * MICRO, nTimeUndo * MILLI / nBlocksTotal);
2197
+
2194
2198
if (!pindex->IsValid (BLOCK_VALID_SCRIPTS)) {
2195
2199
pindex->RaiseValidity (BLOCK_VALID_SCRIPTS);
2196
2200
m_blockman.m_dirty_blockindex .insert (pindex);
@@ -2200,8 +2204,8 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
2200
2204
// add this block to the view's block chain
2201
2205
view.SetBestBlock (pindex->GetBlockHash ());
2202
2206
2203
- int64_t nTime5 = GetTimeMicros (); nTimeIndex += nTime5 - nTime4 ;
2204
- LogPrint (BCLog::BENCH, " - Index writing: %.2fms [%.2fs (%.2fms/blk)]\n " , MILLI * (nTime5 - nTime4 ), nTimeIndex * MICRO, nTimeIndex * MILLI / nBlocksTotal);
2207
+ int64_t nTime6 = GetTimeMicros (); nTimeIndex += nTime6 - nTime5 ;
2208
+ LogPrint (BCLog::BENCH, " - Index writing: %.2fms [%.2fs (%.2fms/blk)]\n " , MILLI * (nTime6 - nTime5 ), nTimeIndex * MICRO, nTimeIndex * MILLI / nBlocksTotal);
2205
2209
2206
2210
TRACE6 (validation, block_connected,
2207
2211
block_hash.data (),
@@ -2540,7 +2544,7 @@ bool CChainState::DisconnectTip(BlockValidationState& state, DisconnectedBlockTr
2540
2544
return true ;
2541
2545
}
2542
2546
2543
- static int64_t nTimeReadFromDisk = 0 ;
2547
+ static int64_t nTimeReadFromDiskTotal = 0 ;
2544
2548
static int64_t nTimeConnectTotal = 0 ;
2545
2549
static int64_t nTimeFlush = 0 ;
2546
2550
static int64_t nTimeChainState = 0 ;
@@ -2608,13 +2612,14 @@ bool CChainState::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew
2608
2612
}
2609
2613
pthisBlock = pblockNew;
2610
2614
} else {
2615
+ LogPrint (BCLog::BENCH, " - Using cached block\n " );
2611
2616
pthisBlock = pblock;
2612
2617
}
2613
2618
const CBlock& blockConnecting = *pthisBlock;
2614
2619
// Apply the block atomically to the chain state.
2615
- int64_t nTime2 = GetTimeMicros (); nTimeReadFromDisk += nTime2 - nTime1;
2620
+ int64_t nTime2 = GetTimeMicros (); nTimeReadFromDiskTotal += nTime2 - nTime1;
2616
2621
int64_t nTime3;
2617
- LogPrint (BCLog::BENCH, " - Load block from disk: %.2fms [%.2fs]\n " , (nTime2 - nTime1) * MILLI, nTimeReadFromDisk * MICRO);
2622
+ LogPrint (BCLog::BENCH, " - Load block from disk: %.2fms [%.2fs (%.2fms/blk) ]\n " , (nTime2 - nTime1) * MILLI, nTimeReadFromDiskTotal * MICRO, nTimeReadFromDiskTotal * MILLI / nBlocksTotal );
2618
2623
{
2619
2624
CCoinsViewCache view (&CoinsTip ());
2620
2625
bool rv = ConnectBlock (blockConnecting, state, pindexNew, view);
0 commit comments