mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
log, sync: add LOCK logging category, apply it to lock contention
This commit is contained in:
parent
bb9f76a719
commit
b7a17444e0
4 changed files with 5 additions and 3 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue