This diff:
- adds a LOCK logging category if DEBUG_LOCKCONTENTION is defined at compilation.
- adds a timing macro in microseconds, `LOG_TIME_MICROS_WITH_CATEGORY`
- updates `BCLog::LogMsg()` to omit irrelevant decimals for microseconds and skip unneeded code and math.
- improves the lock contention logging, drops the all-caps, and displays the duration in microseconds
- makes unexpected time type in `BCLog::LogMsg()` a compile-time error
- add a paragraph of documentation to developer-notes.md
Lock contention logging in checkqueue_tests is disabled, as some of these tests are designed to be heavily contested to trigger race conditions or other issues. This created very large log files when run with DEBUG_LOCKCONTENTION defined.
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/22736 | core#22736]], [[https://github.com/bitcoin/bitcoin/pull/22904 | core#22904]], [[https://github.com/bitcoin/bitcoin/pull/23223 | core#23223]] and [[https://github.com/bitcoin/bitcoin/pull/24470 | core#24470]]
The first pull request implements the lock category, the other pull requests are important follow-ups (mixed with minor refactorings) fixing various regressions (bugs and suspected performance issues).
Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
Co-authored-by: practicalswift <practicalswift@users.noreply.github.com>
Co-authored-by: Martin Ankerl <martin.ankerl@gmail.com>