mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
log, sync: add LOCK logging category, apply it to lock contention
This commit is contained in:
@@ -159,6 +159,7 @@ const CLogCategoryDesc LogCategories[] =
|
|||||||
{BCLog::VALIDATION, "validation"},
|
{BCLog::VALIDATION, "validation"},
|
||||||
{BCLog::I2P, "i2p"},
|
{BCLog::I2P, "i2p"},
|
||||||
{BCLog::IPC, "ipc"},
|
{BCLog::IPC, "ipc"},
|
||||||
|
{BCLog::LOCK, "lock"},
|
||||||
{BCLog::ALL, "1"},
|
{BCLog::ALL, "1"},
|
||||||
{BCLog::ALL, "all"},
|
{BCLog::ALL, "all"},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ namespace BCLog {
|
|||||||
VALIDATION = (1 << 21),
|
VALIDATION = (1 << 21),
|
||||||
I2P = (1 << 22),
|
I2P = (1 << 22),
|
||||||
IPC = (1 << 23),
|
IPC = (1 << 23),
|
||||||
|
LOCK = (1 << 24),
|
||||||
ALL = ~(uint32_t)0,
|
ALL = ~(uint32_t)0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ static_assert(false, "thread_local is not supported");
|
|||||||
#endif
|
#endif
|
||||||
void PrintLockContention(const char* pszName, const char* pszFile, int nLine)
|
void PrintLockContention(const char* pszName, const char* pszFile, int nLine)
|
||||||
{
|
{
|
||||||
LogPrintf("LOCKCONTENTION: %s\n", pszName);
|
LogPrint(BCLog::LOCK, "LOCKCONTENTION: %s\n", pszName);
|
||||||
LogPrintf("Locker: %s:%d\n", pszFile, nLine);
|
LogPrint(BCLog::LOCK, "Locker: %s:%d\n", pszFile, nLine);
|
||||||
}
|
}
|
||||||
#endif /* DEBUG_LOCKCONTENTION */
|
#endif /* DEBUG_LOCKCONTENTION */
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class RpcMiscTest(BitcoinTestFramework):
|
|||||||
self.log.info("test logging rpc and help")
|
self.log.info("test logging rpc and help")
|
||||||
|
|
||||||
# Test logging RPC returns the expected number of logging categories.
|
# Test logging RPC returns the expected number of logging categories.
|
||||||
assert_equal(len(node.logging()), 24)
|
assert_equal(len(node.logging()), 25)
|
||||||
|
|
||||||
# Test toggling a logging category on/off/on with the logging RPC.
|
# Test toggling a logging category on/off/on with the logging RPC.
|
||||||
assert_equal(node.logging()['qt'], True)
|
assert_equal(node.logging()['qt'], True)
|
||||||
|
|||||||
Reference in New Issue
Block a user