-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add transactions.mempool.lockedTransactions and chainlocks.blockHeight stats #6237
base: develop
Are you sure you want to change the base?
Changes from all commits
bf54a5d
749d371
b836f25
508bade
3e52422
3574550
7bbbc15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,6 +253,9 @@ class CInstantSendManager : public CRecoveredSigsListener | |
mutable Mutex cs_pendingRetry; | ||
std::unordered_set<uint256, StaticSaltedHasher> pendingRetryTxs GUARDED_BY(cs_pendingRetry); | ||
|
||
mutable Mutex cs_timingsTxSeen; | ||
std::unordered_map<uint256, int64_t, StaticSaltedHasher> timingsTxSeen GUARDED_BY(cs_timingsTxSeen); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it seems as this map can indefinitely grow and eat |
||
|
||
public: | ||
explicit CInstantSendManager(CChainLocksHandler& _clhandler, CChainState& chainstate, CQuorumManager& _qman, | ||
CSigningManager& _sigman, CSigSharesManager& _shareman, CSporkManager& sporkman, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2301,7 +2301,7 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state, | |
|
||
::g_stats_client->timing("ConnectBlock_ms", (nTime8 - nTimeStart) / 1000, 1.0f); | ||
::g_stats_client->gauge("blocks.tip.SizeBytes", ::GetSerializeSize(block, PROTOCOL_VERSION), 1.0f); | ||
::g_stats_client->gauge("blocks.tip.Height", m_chain.Height(), 1.0f); | ||
::g_stats_client->gauge("blocks.tip.Height", m_chain.Height() + 1, 1.0f); // without the +1, the "tip.Height" doesn't match rpc calls like `getblockcount` | ||
::g_stats_client->gauge("blocks.tip.Version", block.nVersion, 1.0f); | ||
::g_stats_client->gauge("blocks.tip.NumTransactions", block.vtx.size(), 1.0f); | ||
::g_stats_client->gauge("blocks.tip.SigOps", nSigOps, 1.0f); | ||
Comment on lines
2303
to
2307
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should drop all updates for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because chain tip is updated in |
||
|
@@ -2623,6 +2623,8 @@ bool CChainState::DisconnectTip(BlockValidationState& state, DisconnectedBlockTr | |
AssertLockHeld(cs_main); | ||
if (m_mempool) AssertLockHeld(m_mempool->cs); | ||
|
||
int64_t nTime1 = GetTimeMicros(); | ||
|
||
CBlockIndex *pindexDelete = m_chain.Tip(); | ||
assert(pindexDelete); | ||
// Read block from disk. | ||
|
@@ -2681,6 +2683,19 @@ bool CChainState::DisconnectTip(BlockValidationState& state, DisconnectedBlockTr | |
// Let wallets know transactions went from 1-confirmed to | ||
// 0-confirmed or conflicted: | ||
GetMainSignals().BlockDisconnected(pblock, pindexDelete); | ||
|
||
int64_t nTime2 = GetTimeMicros(); | ||
|
||
unsigned int nSigOps = 0; | ||
for (const auto& tx : block.vtx) { | ||
nSigOps += GetLegacySigOpCount(*tx); | ||
} | ||
::g_stats_client->timing("DisconnectTip_ms", (nTime2 - nTime1) / 1000, 1.0f); | ||
::g_stats_client->gauge("blocks.tip.SizeBytes", ::GetSerializeSize(block, PROTOCOL_VERSION), 1.0f); | ||
::g_stats_client->gauge("blocks.tip.Height", m_chain.Height(), 1.0f); | ||
::g_stats_client->gauge("blocks.tip.Version", block.nVersion, 1.0f); | ||
::g_stats_client->gauge("blocks.tip.NumTransactions", block.vtx.size(), 1.0f); | ||
::g_stats_client->gauge("blocks.tip.SigOps", nSigOps, 1.0f); | ||
return true; | ||
} | ||
|
||
|
@@ -2799,7 +2814,16 @@ bool CChainState::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew | |
LogPrint(BCLog::BENCHMARK, " - Connect postprocess: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime6 - nTime5) * MILLI, nTimePostConnect * MICRO, nTimePostConnect * MILLI / nBlocksTotal); | ||
LogPrint(BCLog::BENCHMARK, "- Connect block: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime6 - nTime1) * MILLI, nTimeTotal * MICRO, nTimeTotal * MILLI / nBlocksTotal); | ||
|
||
unsigned int nSigOps = 0; | ||
for (const auto& tx : blockConnecting.vtx) { | ||
nSigOps += GetLegacySigOpCount(*tx); | ||
} | ||
::g_stats_client->timing("ConnectTip_ms", (nTime6 - nTime1) / 1000, 1.0f); | ||
::g_stats_client->gauge("blocks.tip.SizeBytes", ::GetSerializeSize(blockConnecting, PROTOCOL_VERSION), 1.0f); | ||
::g_stats_client->gauge("blocks.tip.Height", m_chain.Height(), 1.0f); | ||
::g_stats_client->gauge("blocks.tip.Version", blockConnecting.nVersion, 1.0f); | ||
::g_stats_client->gauge("blocks.tip.NumTransactions", blockConnecting.vtx.size(), 1.0f); | ||
::g_stats_client->gauge("blocks.tip.SigOps", nSigOps, 1.0f); | ||
|
||
connectTrace.BlockConnected(pindexNew, std::move(pthisBlock)); | ||
return true; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's avoid double lookup on map here:
emplace() and try_emplace() are similar, but difference in performance - one is expecting success by default, other is expecting failure by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proof that it works: