Skip to content

Commit b7a1744

Browse files
committed
log, sync: add LOCK logging category, apply it to lock contention
1 parent bb9f76a commit b7a1744

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

src/logging.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ const CLogCategoryDesc LogCategories[] =
159159
{BCLog::VALIDATION, "validation"},
160160
{BCLog::I2P, "i2p"},
161161
{BCLog::IPC, "ipc"},
162+
{BCLog::LOCK, "lock"},
162163
{BCLog::ALL, "1"},
163164
{BCLog::ALL, "all"},
164165
};

src/logging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ namespace BCLog {
5959
VALIDATION = (1 << 21),
6060
I2P = (1 << 22),
6161
IPC = (1 << 23),
62+
LOCK = (1 << 24),
6263
ALL = ~(uint32_t)0,
6364
};
6465

src/sync.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ static_assert(false, "thread_local is not supported");
2929
#endif
3030
void PrintLockContention(const char* pszName, const char* pszFile, int nLine)
3131
{
32-
LogPrintf("LOCKCONTENTION: %s\n", pszName);
33-
LogPrintf("Locker: %s:%d\n", pszFile, nLine);
32+
LogPrint(BCLog::LOCK, "LOCKCONTENTION: %s\n", pszName);
33+
LogPrint(BCLog::LOCK, "Locker: %s:%d\n", pszFile, nLine);
3434
}
3535
#endif /* DEBUG_LOCKCONTENTION */
3636

test/functional/rpc_misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def run_test(self):
5757
self.log.info("test logging rpc and help")
5858

5959
# Test logging RPC returns the expected number of logging categories.
60-
assert_equal(len(node.logging()), 24)
60+
assert_equal(len(node.logging()), 25)
6161

6262
# Test toggling a logging category on/off/on with the logging RPC.
6363
assert_equal(node.logging()['qt'], True)

0 commit comments

Comments
 (0)