mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
Merge bitcoin/bitcoin#26118: log: Use steady clock for bench logging
fabf1cdb20
Use steady clock for bench logging (MacroFake)faed342a23
scripted-diff: Rename time symbols (MacroFake) Pull request description: Instead of using `0.001` and similar constants to "convert" an int64_t to milliseconds, use the type-safe `Ticks<>` helper. Also, use steady clock instead of system clock, since the durations are used for benchmarking. ACKs for top commit: fanquake: ACKfabf1cdb20
- validation bench output still looks sane. Tree-SHA512: e6525b5fdad6045ca500c56014897d7428ad288aaf375933d3b5939feddf257f6910d562eb66ebcde9186bef9a604ee8d763a318253838318d59df2a285be7c2
This commit is contained in:
commit
239757409b
5 changed files with 111 additions and 58 deletions
|
@ -105,7 +105,7 @@ void BlockAssembler::resetBlock()
|
|||
|
||||
std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||
{
|
||||
int64_t nTimeStart = GetTimeMicros();
|
||||
const auto time_start{SteadyClock::now()};
|
||||
|
||||
resetBlock();
|
||||
|
||||
|
@ -143,7 +143,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
|
|||
addPackageTxs(*m_mempool, nPackagesSelected, nDescendantsUpdated);
|
||||
}
|
||||
|
||||
int64_t nTime1 = GetTimeMicros();
|
||||
const auto time_1{SteadyClock::now()};
|
||||
|
||||
m_last_block_num_txs = nBlockTx;
|
||||
m_last_block_weight = nBlockWeight;
|
||||
|
@ -173,9 +173,12 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
|
|||
if (!TestBlockValidity(state, chainparams, m_chainstate, *pblock, pindexPrev, GetAdjustedTime, false, false)) {
|
||||
throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", __func__, state.ToString()));
|
||||
}
|
||||
int64_t nTime2 = GetTimeMicros();
|
||||
const auto time_2{SteadyClock::now()};
|
||||
|
||||
LogPrint(BCLog::BENCH, "CreateNewBlock() packages: %.2fms (%d packages, %d updated descendants), validity: %.2fms (total %.2fms)\n", 0.001 * (nTime1 - nTimeStart), nPackagesSelected, nDescendantsUpdated, 0.001 * (nTime2 - nTime1), 0.001 * (nTime2 - nTimeStart));
|
||||
LogPrint(BCLog::BENCH, "CreateNewBlock() packages: %.2fms (%d packages, %d updated descendants), validity: %.2fms (total %.2fms)\n",
|
||||
Ticks<MillisecondsDouble>(time_1 - time_start), nPackagesSelected, nDescendantsUpdated,
|
||||
Ticks<MillisecondsDouble>(time_2 - time_1),
|
||||
Ticks<MillisecondsDouble>(time_2 - time_start));
|
||||
|
||||
return std::move(pblocktemplate);
|
||||
}
|
||||
|
|
|
@ -997,8 +997,9 @@ bool CBlockPolicyEstimator::Read(AutoFile& filein)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CBlockPolicyEstimator::FlushUnconfirmed() {
|
||||
int64_t startclear = GetTimeMicros();
|
||||
void CBlockPolicyEstimator::FlushUnconfirmed()
|
||||
{
|
||||
const auto startclear{SteadyClock::now()};
|
||||
LOCK(m_cs_fee_estimator);
|
||||
size_t num_entries = mapMemPoolTxs.size();
|
||||
// Remove every entry in mapMemPoolTxs
|
||||
|
@ -1006,8 +1007,8 @@ void CBlockPolicyEstimator::FlushUnconfirmed() {
|
|||
auto mi = mapMemPoolTxs.begin();
|
||||
_removeTx(mi->first, false); // this calls erase() on mapMemPoolTxs
|
||||
}
|
||||
int64_t endclear = GetTimeMicros();
|
||||
LogPrint(BCLog::ESTIMATEFEE, "Recorded %u unconfirmed txs from mempool in %gs\n", num_entries, (endclear - startclear)*0.000001);
|
||||
const auto endclear{SteadyClock::now()};
|
||||
LogPrint(BCLog::ESTIMATEFEE, "Recorded %u unconfirmed txs from mempool in %gs\n", num_entries, Ticks<SecondsDouble>(endclear - startclear));
|
||||
}
|
||||
|
||||
FeeFilterRounder::FeeFilterRounder(const CFeeRate& minIncrementalFee)
|
||||
|
|
|
@ -730,10 +730,10 @@ static RPCHelpMan getblocktemplate()
|
|||
|
||||
// Update block
|
||||
static CBlockIndex* pindexPrev;
|
||||
static int64_t nStart;
|
||||
static int64_t time_start;
|
||||
static std::unique_ptr<CBlockTemplate> pblocktemplate;
|
||||
if (pindexPrev != active_chain.Tip() ||
|
||||
(mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 5))
|
||||
(mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - time_start > 5))
|
||||
{
|
||||
// Clear pindexPrev so future calls make a new block, despite any failures from here on
|
||||
pindexPrev = nullptr;
|
||||
|
@ -741,7 +741,7 @@ static RPCHelpMan getblocktemplate()
|
|||
// Store the pindexBest used before CreateNewBlock, to avoid races
|
||||
nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
|
||||
CBlockIndex* pindexPrevNew = active_chain.Tip();
|
||||
nStart = GetTime();
|
||||
time_start = GetTime();
|
||||
|
||||
// Create new block
|
||||
CScript scriptDummy = CScript() << OP_TRUE;
|
||||
|
|
|
@ -57,6 +57,7 @@ constexpr int64_t count_microseconds(std::chrono::microseconds t) { return t.cou
|
|||
|
||||
using HoursDouble = std::chrono::duration<double, std::chrono::hours::period>;
|
||||
using SecondsDouble = std::chrono::duration<double, std::chrono::seconds::period>;
|
||||
using MillisecondsDouble = std::chrono::duration<double, std::chrono::milliseconds::period>;
|
||||
|
||||
/**
|
||||
* DEPRECATED
|
||||
|
|
|
@ -82,9 +82,6 @@ using node::SnapshotMetadata;
|
|||
using node::UndoReadFromDisk;
|
||||
using node::UnlinkPrunedFiles;
|
||||
|
||||
#define MICRO 0.000001
|
||||
#define MILLI 0.001
|
||||
|
||||
/** Maximum kilobytes for transactions to store for processing during reorg */
|
||||
static const unsigned int MAX_DISCONNECTED_TX_POOL_SIZE = 20000;
|
||||
/** Time to wait between writing blocks/block index to disk. */
|
||||
|
@ -1966,14 +1963,14 @@ static unsigned int GetBlockScriptFlags(const CBlockIndex& block_index, const Ch
|
|||
}
|
||||
|
||||
|
||||
static int64_t nTimeCheck = 0;
|
||||
static int64_t nTimeForks = 0;
|
||||
static int64_t nTimeConnect = 0;
|
||||
static int64_t nTimeVerify = 0;
|
||||
static int64_t nTimeUndo = 0;
|
||||
static int64_t nTimeIndex = 0;
|
||||
static int64_t nTimeTotal = 0;
|
||||
static int64_t nBlocksTotal = 0;
|
||||
static SteadyClock::duration time_check{};
|
||||
static SteadyClock::duration time_forks{};
|
||||
static SteadyClock::duration time_connect{};
|
||||
static SteadyClock::duration time_verify{};
|
||||
static SteadyClock::duration time_undo{};
|
||||
static SteadyClock::duration time_index{};
|
||||
static SteadyClock::duration time_total{};
|
||||
static int64_t num_blocks_total = 0;
|
||||
|
||||
/** Apply the effects of this block (with given index) on the UTXO set represented by coins.
|
||||
* Validity checks that depend on the UTXO set are also done; ConnectBlock()
|
||||
|
@ -1987,7 +1984,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||
uint256 block_hash{block.GetHash()};
|
||||
assert(*pindex->phashBlock == block_hash);
|
||||
|
||||
int64_t nTimeStart = GetTimeMicros();
|
||||
const auto time_start{SteadyClock::now()};
|
||||
|
||||
// Check it again in case a previous version let a bad block in
|
||||
// NOTE: We don't currently (re-)invoke ContextualCheckBlock() or
|
||||
|
@ -2016,7 +2013,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||
uint256 hashPrevBlock = pindex->pprev == nullptr ? uint256() : pindex->pprev->GetBlockHash();
|
||||
assert(hashPrevBlock == view.GetBestBlock());
|
||||
|
||||
nBlocksTotal++;
|
||||
num_blocks_total++;
|
||||
|
||||
// Special case for the genesis block, skipping connection of its transactions
|
||||
// (its coinbase is unspendable)
|
||||
|
@ -2057,8 +2054,12 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||
}
|
||||
}
|
||||
|
||||
int64_t nTime1 = GetTimeMicros(); nTimeCheck += nTime1 - nTimeStart;
|
||||
LogPrint(BCLog::BENCH, " - Sanity checks: %.2fms [%.2fs (%.2fms/blk)]\n", MILLI * (nTime1 - nTimeStart), nTimeCheck * MICRO, nTimeCheck * MILLI / nBlocksTotal);
|
||||
const auto time_1{SteadyClock::now()};
|
||||
time_check += time_1 - time_start;
|
||||
LogPrint(BCLog::BENCH, " - Sanity checks: %.2fms [%.2fs (%.2fms/blk)]\n",
|
||||
Ticks<MillisecondsDouble>(time_1 - time_start),
|
||||
Ticks<SecondsDouble>(time_check),
|
||||
Ticks<MillisecondsDouble>(time_check) / num_blocks_total);
|
||||
|
||||
// Do not allow blocks that contain transactions which 'overwrite' older transactions,
|
||||
// unless those are already completely spent.
|
||||
|
@ -2156,8 +2157,12 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||
// Get the script flags for this block
|
||||
unsigned int flags{GetBlockScriptFlags(*pindex, m_chainman)};
|
||||
|
||||
int64_t nTime2 = GetTimeMicros(); nTimeForks += nTime2 - nTime1;
|
||||
LogPrint(BCLog::BENCH, " - Fork checks: %.2fms [%.2fs (%.2fms/blk)]\n", MILLI * (nTime2 - nTime1), nTimeForks * MICRO, nTimeForks * MILLI / nBlocksTotal);
|
||||
const auto time_2{SteadyClock::now()};
|
||||
time_forks += time_2 - time_1;
|
||||
LogPrint(BCLog::BENCH, " - Fork checks: %.2fms [%.2fs (%.2fms/blk)]\n",
|
||||
Ticks<MillisecondsDouble>(time_2 - time_1),
|
||||
Ticks<SecondsDouble>(time_forks),
|
||||
Ticks<MillisecondsDouble>(time_forks) / num_blocks_total);
|
||||
|
||||
CBlockUndo blockundo;
|
||||
|
||||
|
@ -2241,8 +2246,13 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||
}
|
||||
UpdateCoins(tx, view, i == 0 ? undoDummy : blockundo.vtxundo.back(), pindex->nHeight);
|
||||
}
|
||||
int64_t nTime3 = GetTimeMicros(); nTimeConnect += nTime3 - nTime2;
|
||||
LogPrint(BCLog::BENCH, " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs (%.2fms/blk)]\n", (unsigned)block.vtx.size(), MILLI * (nTime3 - nTime2), MILLI * (nTime3 - nTime2) / block.vtx.size(), nInputs <= 1 ? 0 : MILLI * (nTime3 - nTime2) / (nInputs-1), nTimeConnect * MICRO, nTimeConnect * MILLI / nBlocksTotal);
|
||||
const auto time_3{SteadyClock::now()};
|
||||
time_connect += time_3 - time_2;
|
||||
LogPrint(BCLog::BENCH, " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs (%.2fms/blk)]\n", (unsigned)block.vtx.size(),
|
||||
Ticks<MillisecondsDouble>(time_3 - time_2), Ticks<MillisecondsDouble>(time_3 - time_2) / block.vtx.size(),
|
||||
nInputs <= 1 ? 0 : Ticks<MillisecondsDouble>(time_3 - time_2) / (nInputs - 1),
|
||||
Ticks<SecondsDouble>(time_connect),
|
||||
Ticks<MillisecondsDouble>(time_connect) / num_blocks_total);
|
||||
|
||||
CAmount blockReward = nFees + GetBlockSubsidy(pindex->nHeight, m_params.GetConsensus());
|
||||
if (block.vtx[0]->GetValueOut() > blockReward) {
|
||||
|
@ -2254,8 +2264,13 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||
LogPrintf("ERROR: %s: CheckQueue failed\n", __func__);
|
||||
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "block-validation-failed");
|
||||
}
|
||||
int64_t nTime4 = GetTimeMicros(); nTimeVerify += nTime4 - nTime2;
|
||||
LogPrint(BCLog::BENCH, " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs (%.2fms/blk)]\n", nInputs - 1, MILLI * (nTime4 - nTime2), nInputs <= 1 ? 0 : MILLI * (nTime4 - nTime2) / (nInputs-1), nTimeVerify * MICRO, nTimeVerify * MILLI / nBlocksTotal);
|
||||
const auto time_4{SteadyClock::now()};
|
||||
time_verify += time_4 - time_2;
|
||||
LogPrint(BCLog::BENCH, " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs (%.2fms/blk)]\n", nInputs - 1,
|
||||
Ticks<MillisecondsDouble>(time_4 - time_2),
|
||||
nInputs <= 1 ? 0 : Ticks<MillisecondsDouble>(time_4 - time_2) / (nInputs - 1),
|
||||
Ticks<SecondsDouble>(time_verify),
|
||||
Ticks<MillisecondsDouble>(time_verify) / num_blocks_total);
|
||||
|
||||
if (fJustCheck)
|
||||
return true;
|
||||
|
@ -2264,8 +2279,12 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||
return false;
|
||||
}
|
||||
|
||||
int64_t nTime5 = GetTimeMicros(); nTimeUndo += nTime5 - nTime4;
|
||||
LogPrint(BCLog::BENCH, " - Write undo data: %.2fms [%.2fs (%.2fms/blk)]\n", MILLI * (nTime5 - nTime4), nTimeUndo * MICRO, nTimeUndo * MILLI / nBlocksTotal);
|
||||
const auto time_5{SteadyClock::now()};
|
||||
time_undo += time_5 - time_4;
|
||||
LogPrint(BCLog::BENCH, " - Write undo data: %.2fms [%.2fs (%.2fms/blk)]\n",
|
||||
Ticks<MillisecondsDouble>(time_5 - time_4),
|
||||
Ticks<SecondsDouble>(time_undo),
|
||||
Ticks<MillisecondsDouble>(time_undo) / num_blocks_total);
|
||||
|
||||
if (!pindex->IsValid(BLOCK_VALID_SCRIPTS)) {
|
||||
pindex->RaiseValidity(BLOCK_VALID_SCRIPTS);
|
||||
|
@ -2275,8 +2294,12 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||
// add this block to the view's block chain
|
||||
view.SetBestBlock(pindex->GetBlockHash());
|
||||
|
||||
int64_t nTime6 = GetTimeMicros(); nTimeIndex += nTime6 - nTime5;
|
||||
LogPrint(BCLog::BENCH, " - Index writing: %.2fms [%.2fs (%.2fms/blk)]\n", MILLI * (nTime6 - nTime5), nTimeIndex * MICRO, nTimeIndex * MILLI / nBlocksTotal);
|
||||
const auto time_6{SteadyClock::now()};
|
||||
time_index += time_6 - time_5;
|
||||
LogPrint(BCLog::BENCH, " - Index writing: %.2fms [%.2fs (%.2fms/blk)]\n",
|
||||
Ticks<MillisecondsDouble>(time_6 - time_5),
|
||||
Ticks<SecondsDouble>(time_index),
|
||||
Ticks<MillisecondsDouble>(time_index) / num_blocks_total);
|
||||
|
||||
TRACE6(validation, block_connected,
|
||||
block_hash.data(),
|
||||
|
@ -2284,7 +2307,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||
block.vtx.size(),
|
||||
nInputs,
|
||||
nSigOpsCost,
|
||||
nTime5 - nTimeStart // in microseconds (µs)
|
||||
time_5 - time_start // in microseconds (µs)
|
||||
);
|
||||
|
||||
return true;
|
||||
|
@ -2591,7 +2614,7 @@ bool Chainstate::DisconnectTip(BlockValidationState& state, DisconnectedBlockTra
|
|||
return error("DisconnectTip(): Failed to read block");
|
||||
}
|
||||
// Apply the block atomically to the chain state.
|
||||
int64_t nStart = GetTimeMicros();
|
||||
const auto time_start{SteadyClock::now()};
|
||||
{
|
||||
CCoinsViewCache view(&CoinsTip());
|
||||
assert(view.GetBestBlock() == pindexDelete->GetBlockHash());
|
||||
|
@ -2600,7 +2623,8 @@ bool Chainstate::DisconnectTip(BlockValidationState& state, DisconnectedBlockTra
|
|||
bool flushed = view.Flush();
|
||||
assert(flushed);
|
||||
}
|
||||
LogPrint(BCLog::BENCH, "- Disconnect block: %.2fms\n", (GetTimeMicros() - nStart) * MILLI);
|
||||
LogPrint(BCLog::BENCH, "- Disconnect block: %.2fms\n",
|
||||
Ticks<MillisecondsDouble>(SteadyClock::now() - time_start));
|
||||
|
||||
{
|
||||
// Prune locks that began at or after the tip should be moved backward so they get a chance to reorg
|
||||
|
@ -2640,11 +2664,11 @@ bool Chainstate::DisconnectTip(BlockValidationState& state, DisconnectedBlockTra
|
|||
return true;
|
||||
}
|
||||
|
||||
static int64_t nTimeReadFromDiskTotal = 0;
|
||||
static int64_t nTimeConnectTotal = 0;
|
||||
static int64_t nTimeFlush = 0;
|
||||
static int64_t nTimeChainState = 0;
|
||||
static int64_t nTimePostConnect = 0;
|
||||
static SteadyClock::duration time_read_from_disk_total{};
|
||||
static SteadyClock::duration time_connect_total{};
|
||||
static SteadyClock::duration time_flush{};
|
||||
static SteadyClock::duration time_chainstate{};
|
||||
static SteadyClock::duration time_post_connect{};
|
||||
|
||||
struct PerBlockConnectTrace {
|
||||
CBlockIndex* pindex = nullptr;
|
||||
|
@ -2699,7 +2723,7 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew,
|
|||
|
||||
assert(pindexNew->pprev == m_chain.Tip());
|
||||
// Read block from disk.
|
||||
int64_t nTime1 = GetTimeMicros();
|
||||
const auto time_1{SteadyClock::now()};
|
||||
std::shared_ptr<const CBlock> pthisBlock;
|
||||
if (!pblock) {
|
||||
std::shared_ptr<CBlock> pblockNew = std::make_shared<CBlock>();
|
||||
|
@ -2713,9 +2737,13 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew,
|
|||
}
|
||||
const CBlock& blockConnecting = *pthisBlock;
|
||||
// Apply the block atomically to the chain state.
|
||||
int64_t nTime2 = GetTimeMicros(); nTimeReadFromDiskTotal += nTime2 - nTime1;
|
||||
int64_t nTime3;
|
||||
LogPrint(BCLog::BENCH, " - Load block from disk: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime2 - nTime1) * MILLI, nTimeReadFromDiskTotal * MICRO, nTimeReadFromDiskTotal * MILLI / nBlocksTotal);
|
||||
const auto time_2{SteadyClock::now()};
|
||||
time_read_from_disk_total += time_2 - time_1;
|
||||
SteadyClock::time_point time_3;
|
||||
LogPrint(BCLog::BENCH, " - Load block from disk: %.2fms [%.2fs (%.2fms/blk)]\n",
|
||||
Ticks<MillisecondsDouble>(time_2 - time_1),
|
||||
Ticks<SecondsDouble>(time_read_from_disk_total),
|
||||
Ticks<MillisecondsDouble>(time_read_from_disk_total) / num_blocks_total);
|
||||
{
|
||||
CCoinsViewCache view(&CoinsTip());
|
||||
bool rv = ConnectBlock(blockConnecting, state, pindexNew, view);
|
||||
|
@ -2725,20 +2753,32 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew,
|
|||
InvalidBlockFound(pindexNew, state);
|
||||
return error("%s: ConnectBlock %s failed, %s", __func__, pindexNew->GetBlockHash().ToString(), state.ToString());
|
||||
}
|
||||
nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2;
|
||||
assert(nBlocksTotal > 0);
|
||||
LogPrint(BCLog::BENCH, " - Connect total: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime3 - nTime2) * MILLI, nTimeConnectTotal * MICRO, nTimeConnectTotal * MILLI / nBlocksTotal);
|
||||
time_3 = SteadyClock::now();
|
||||
time_connect_total += time_3 - time_2;
|
||||
assert(num_blocks_total > 0);
|
||||
LogPrint(BCLog::BENCH, " - Connect total: %.2fms [%.2fs (%.2fms/blk)]\n",
|
||||
Ticks<MillisecondsDouble>(time_3 - time_2),
|
||||
Ticks<SecondsDouble>(time_connect_total),
|
||||
Ticks<MillisecondsDouble>(time_connect_total) / num_blocks_total);
|
||||
bool flushed = view.Flush();
|
||||
assert(flushed);
|
||||
}
|
||||
int64_t nTime4 = GetTimeMicros(); nTimeFlush += nTime4 - nTime3;
|
||||
LogPrint(BCLog::BENCH, " - Flush: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime4 - nTime3) * MILLI, nTimeFlush * MICRO, nTimeFlush * MILLI / nBlocksTotal);
|
||||
const auto time_4{SteadyClock::now()};
|
||||
time_flush += time_4 - time_3;
|
||||
LogPrint(BCLog::BENCH, " - Flush: %.2fms [%.2fs (%.2fms/blk)]\n",
|
||||
Ticks<MillisecondsDouble>(time_4 - time_3),
|
||||
Ticks<SecondsDouble>(time_flush),
|
||||
Ticks<MillisecondsDouble>(time_flush) / num_blocks_total);
|
||||
// Write the chain state to disk, if necessary.
|
||||
if (!FlushStateToDisk(state, FlushStateMode::IF_NEEDED)) {
|
||||
return false;
|
||||
}
|
||||
int64_t nTime5 = GetTimeMicros(); nTimeChainState += nTime5 - nTime4;
|
||||
LogPrint(BCLog::BENCH, " - Writing chainstate: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime5 - nTime4) * MILLI, nTimeChainState * MICRO, nTimeChainState * MILLI / nBlocksTotal);
|
||||
const auto time_5{SteadyClock::now()};
|
||||
time_chainstate += time_5 - time_4;
|
||||
LogPrint(BCLog::BENCH, " - Writing chainstate: %.2fms [%.2fs (%.2fms/blk)]\n",
|
||||
Ticks<MillisecondsDouble>(time_5 - time_4),
|
||||
Ticks<SecondsDouble>(time_chainstate),
|
||||
Ticks<MillisecondsDouble>(time_chainstate) / num_blocks_total);
|
||||
// Remove conflicting transactions from the mempool.;
|
||||
if (m_mempool) {
|
||||
m_mempool->removeForBlock(blockConnecting.vtx, pindexNew->nHeight);
|
||||
|
@ -2748,9 +2788,17 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew,
|
|||
m_chain.SetTip(*pindexNew);
|
||||
UpdateTip(pindexNew);
|
||||
|
||||
int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
|
||||
LogPrint(BCLog::BENCH, " - Connect postprocess: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime6 - nTime5) * MILLI, nTimePostConnect * MICRO, nTimePostConnect * MILLI / nBlocksTotal);
|
||||
LogPrint(BCLog::BENCH, "- Connect block: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime6 - nTime1) * MILLI, nTimeTotal * MICRO, nTimeTotal * MILLI / nBlocksTotal);
|
||||
const auto time_6{SteadyClock::now()};
|
||||
time_post_connect += time_6 - time_5;
|
||||
time_total += time_6 - time_1;
|
||||
LogPrint(BCLog::BENCH, " - Connect postprocess: %.2fms [%.2fs (%.2fms/blk)]\n",
|
||||
Ticks<MillisecondsDouble>(time_6 - time_5),
|
||||
Ticks<SecondsDouble>(time_post_connect),
|
||||
Ticks<MillisecondsDouble>(time_post_connect) / num_blocks_total);
|
||||
LogPrint(BCLog::BENCH, "- Connect block: %.2fms [%.2fs (%.2fms/blk)]\n",
|
||||
Ticks<MillisecondsDouble>(time_6 - time_1),
|
||||
Ticks<SecondsDouble>(time_total),
|
||||
Ticks<MillisecondsDouble>(time_total) / num_blocks_total);
|
||||
|
||||
connectTrace.BlockConnected(pindexNew, std::move(pthisBlock));
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue