commit e6b4dc2aed25df7c818298d9107da64a214f684e Author: William Casarin Date: Wed May 20 14:36:37 2020 -0700 usdt tracepoints Signed-off-by: William Casarin diff --git a/src/sync.cpp b/src/sync.cpp index b86c57e498..e90548948b 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -23,8 +24,12 @@ static_assert(false, "thread_local is not supported"); #endif void PrintLockContention(const char* pszName, const char* pszFile, int nLine) { +#ifdef ENABLE_TRACING + TRACE3(locks, contention, pszName, pszFile, nLine); +#else LogPrintf("LOCKCONTENTION: %s\n", pszName); LogPrintf("Locker: %s:%d\n", pszFile, nLine); +#endif } #endif /* DEBUG_LOCKCONTENTION */ diff --git a/src/trace.h b/src/trace.h new file mode 100644 index 0000000000..91b2b76f18 --- /dev/null +++ b/src/trace.h @@ -0,0 +1,26 @@ + + +#ifndef BITCOIN_TRACE_H +#define BITCOIN_TRACE_H + +#if !defined(ENABLE_TRACING) || defined(WIN32) + +#define TRACE(context, event, a) +#define TRACE1(context, event, a) +#define TRACE2(context, event, a, b) +#define TRACE3(context, event, a, b, c) + +#else + +#include + +#define TRACE(context, event) DTRACE_PROBE(context, event) +#define TRACE1(context, event, a) DTRACE_PROBE1(context, event, a) +#define TRACE2(context, event, a, b) DTRACE_PROBE2(context, event, a, b) +#define TRACE3(context, event, a, b, c) DTRACE_PROBE3(context, event, a, b, c) +/* #define TRACE(eventname, data) DTRACE_PROBE("bitcoind", eventname) */ + +#endif + + +#endif /* BITCOIN_TRACE_H */ diff --git a/src/validation.cpp b/src/validation.cpp index db5c595a31..4a5284ece0 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include @@ -1924,6 +1925,7 @@ static int64_t nBlocksTotal = 0; bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, const CChainParams& chainparams, bool fJustCheck) { + TRACE1(chainstate, connect_block, pindex->nHeight); AssertLockHeld(cs_main); assert(pindex); assert(*pindex->phashBlock == block.GetHash());