@@ -1891,8 +1891,9 @@ static unsigned int GetBlockScriptFlags(const CBlockIndex* pindex, const Consens
1891
1891
1892
1892
static int64_t nTimeCheck = 0 ;
1893
1893
static int64_t nTimeForks = 0 ;
1894
- static int64_t nTimeVerify = 0 ;
1895
1894
static int64_t nTimeConnect = 0 ;
1895
+ static int64_t nTimeVerify = 0 ;
1896
+ static int64_t nTimeUndo = 0 ;
1896
1897
static int64_t nTimeIndex = 0 ;
1897
1898
static int64_t nTimeTotal = 0 ;
1898
1899
static int64_t nBlocksTotal = 0 ;
@@ -2183,6 +2184,9 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
2183
2184
return false ;
2184
2185
}
2185
2186
2187
+ int64_t nTime5 = GetTimeMicros (); nTimeUndo += nTime5 - nTime4;
2188
+ LogPrint (BCLog::BENCH, " - Write undo data: %.2fms [%.2fs (%.2fms/blk)]\n " , MILLI * (nTime5 - nTime4), nTimeUndo * MICRO, nTimeUndo * MILLI / nBlocksTotal);
2189
+
2186
2190
if (!pindex->IsValid (BLOCK_VALID_SCRIPTS)) {
2187
2191
pindex->RaiseValidity (BLOCK_VALID_SCRIPTS);
2188
2192
m_blockman.m_dirty_blockindex .insert (pindex);
@@ -2192,8 +2196,8 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
2192
2196
// add this block to the view's block chain
2193
2197
view.SetBestBlock (pindex->GetBlockHash ());
2194
2198
2195
- int64_t nTime5 = GetTimeMicros (); nTimeIndex += nTime5 - nTime4 ;
2196
- LogPrint (BCLog::BENCH, " - Index writing: %.2fms [%.2fs (%.2fms/blk)]\n " , MILLI * (nTime5 - nTime4 ), nTimeIndex * MICRO, nTimeIndex * MILLI / nBlocksTotal);
2199
+ int64_t nTime6 = GetTimeMicros (); nTimeIndex += nTime6 - nTime5 ;
2200
+ LogPrint (BCLog::BENCH, " - Index writing: %.2fms [%.2fs (%.2fms/blk)]\n " , MILLI * (nTime6 - nTime5 ), nTimeIndex * MICRO, nTimeIndex * MILLI / nBlocksTotal);
2197
2201
2198
2202
TRACE6 (validation, block_connected,
2199
2203
block.GetHash ().data (),
@@ -2530,7 +2534,7 @@ bool CChainState::DisconnectTip(BlockValidationState& state, DisconnectedBlockTr
2530
2534
return true ;
2531
2535
}
2532
2536
2533
- static int64_t nTimeReadFromDisk = 0 ;
2537
+ static int64_t nTimeReadFromDiskTotal = 0 ;
2534
2538
static int64_t nTimeConnectTotal = 0 ;
2535
2539
static int64_t nTimeFlush = 0 ;
2536
2540
static int64_t nTimeChainState = 0 ;
@@ -2598,13 +2602,14 @@ bool CChainState::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew
2598
2602
}
2599
2603
pthisBlock = pblockNew;
2600
2604
} else {
2605
+ LogPrint (BCLog::BENCH, " - Using cached block\n " );
2601
2606
pthisBlock = pblock;
2602
2607
}
2603
2608
const CBlock& blockConnecting = *pthisBlock;
2604
2609
// Apply the block atomically to the chain state.
2605
- int64_t nTime2 = GetTimeMicros (); nTimeReadFromDisk += nTime2 - nTime1;
2610
+ int64_t nTime2 = GetTimeMicros (); nTimeReadFromDiskTotal += nTime2 - nTime1;
2606
2611
int64_t nTime3;
2607
- LogPrint (BCLog::BENCH, " - Load block from disk: %.2fms [%.2fs]\n " , (nTime2 - nTime1) * MILLI, nTimeReadFromDisk * MICRO);
2612
+ LogPrint (BCLog::BENCH, " - Load block from disk: %.2fms [%.2fs (%.2fms/blk) ]\n " , (nTime2 - nTime1) * MILLI, nTimeReadFromDiskTotal * MICRO, nTimeReadFromDiskTotal * MILLI / nBlocksTotal );
2608
2613
{
2609
2614
CCoinsViewCache view (&CoinsTip ());
2610
2615
bool rv = ConnectBlock (blockConnecting, state, pindexNew, view);
0 commit comments