Add some spans to the Zcash codebase

This commit is contained in:
Jack Grigg 2020-07-25 11:34:17 +12:00
parent aae7583cdb
commit 253ea6db38
3 changed files with 16 additions and 0 deletions

View File

@ -4321,6 +4321,9 @@ static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned
bool ProcessNewBlock(CValidationState& state, const CChainParams& chainparams, const CNode* pfrom, const CBlock* pblock, bool fForceProcessing, CDiskBlockPos* dbp)
{
auto span = TracingSpan("info", "main", "ProcessNewBlock");
auto spanGuard = span.Enter();
// Preliminary checks
auto verifier = ProofVerifier::Disabled();
bool checked = CheckBlock(*pblock, state, chainparams, verifier);

View File

@ -994,6 +994,8 @@ void ThreadSocketHandler()
if (pnode->fDisconnect ||
(pnode->GetRefCount() <= 0 && pnode->vRecvMsg.empty() && pnode->nSendSize == 0 && pnode->ssSend.empty()))
{
auto spanGuard = pnode->span.Enter();
// remove from vNodes
vNodes.erase(remove(vNodes.begin(), vNodes.end(), pnode), vNodes.end());
@ -1152,6 +1154,8 @@ void ThreadSocketHandler()
{
boost::this_thread::interruption_point();
auto spanGuard = pnode->span.Enter();
//
// Receive
//
@ -1557,6 +1561,8 @@ void ThreadMessageHandler()
if (pnode->fDisconnect)
continue;
auto spanGuard = pnode->span.Enter();
// Receive messages
{
TRY_LOCK(pnode->cs_vRecvMsg, lockRecv);
@ -1890,6 +1896,7 @@ void RelayTransaction(const CTransaction& tx, const CDataStream& ss)
if(!pnode->fRelayTxes)
continue;
LOCK(pnode->cs_filter);
auto spanGuard = pnode->span.Enter();
if (pnode->pfilter)
{
if (pnode->pfilter->IsRelevantAndUpdate(tx))
@ -2101,6 +2108,8 @@ CNode::CNode(SOCKET hSocketIn, const CAddress& addrIn, const std::string& addrNa
nPingUsecTime = 0;
fPingQueued = false;
nMinPingUsecTime = std::numeric_limits<int64_t>::max();
span = TracingSpan("info", "net", "CNode");
auto spanGuard = span.Enter();
{
LOCK(cs_nLastNodeId);

View File

@ -30,6 +30,8 @@
#include <boost/foreach.hpp>
#include <boost/signals2/signal.hpp>
#include <tracing.h>
class CAddrMan;
class CBlockIndex;
class CScheduler;
@ -297,6 +299,8 @@ public:
CBloomFilter* pfilter;
int nRefCount;
NodeId id;
tracing::Span span;
protected:
// Denial-of-service detection/prevention