diff options
author | Jon Atack <jon@atack.com> | 2021-08-18 12:29:36 +0200 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2021-08-18 19:57:15 +0200 |
commit | b7a17444e0746c562ae97b26eba431577947b06a (patch) | |
tree | b2995987513a07c104ebf9944da9a5ee91892dd4 | |
parent | bb9f76a7194a665effab169d228bb8cbc66ccf86 (diff) |
log, sync: add LOCK logging category, apply it to lock contention
-rw-r--r-- | src/logging.cpp | 1 | ||||
-rw-r--r-- | src/logging.h | 1 | ||||
-rw-r--r-- | src/sync.cpp | 4 | ||||
-rwxr-xr-x | test/functional/rpc_misc.py | 2 |
4 files changed, 5 insertions, 3 deletions
diff --git a/src/logging.cpp b/src/logging.cpp index b456108b61..eb2c750296 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -159,6 +159,7 @@ const CLogCategoryDesc LogCategories[] = {BCLog::VALIDATION, "validation"}, {BCLog::I2P, "i2p"}, {BCLog::IPC, "ipc"}, + {BCLog::LOCK, "lock"}, {BCLog::ALL, "1"}, {BCLog::ALL, "all"}, }; diff --git a/src/logging.h b/src/logging.h index 38d73863e7..53a89d28bd 100644 --- a/src/logging.h +++ b/src/logging.h @@ -59,6 +59,7 @@ namespace BCLog { VALIDATION = (1 << 21), I2P = (1 << 22), IPC = (1 << 23), + LOCK = (1 << 24), ALL = ~(uint32_t)0, }; diff --git a/src/sync.cpp b/src/sync.cpp index a2b62c2286..9351417d43 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -29,8 +29,8 @@ static_assert(false, "thread_local is not supported"); #endif void PrintLockContention(const char* pszName, const char* pszFile, int nLine) { - LogPrintf("LOCKCONTENTION: %s\n", pszName); - LogPrintf("Locker: %s:%d\n", pszFile, nLine); + LogPrint(BCLog::LOCK, "LOCKCONTENTION: %s\n", pszName); + LogPrint(BCLog::LOCK, "Locker: %s:%d\n", pszFile, nLine); } #endif /* DEBUG_LOCKCONTENTION */ diff --git a/test/functional/rpc_misc.py b/test/functional/rpc_misc.py index 563f2ea43e..13f33c321f 100755 --- a/test/functional/rpc_misc.py +++ b/test/functional/rpc_misc.py @@ -57,7 +57,7 @@ class RpcMiscTest(BitcoinTestFramework): self.log.info("test logging rpc and help") # 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. assert_equal(node.logging()['qt'], True) |