diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-04-30 15:24:45 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-04-30 15:26:01 -0400 |
commit | 2c35fe6238131f0b5613c3a1230c5019f13f0c09 (patch) | |
tree | 147c6c483807aeeb3316e8e3330db229680e31b8 /src/validation.cpp | |
parent | 10ed4dff24470f22b4bc4030d534f4e1ed5f1c2f (diff) | |
parent | 8722e54e56fd959fd4ff2321b36a7640dee440c5 (diff) |
Merge #15849: Thread names in logs and deadlock debug tools
8722e54e56 threads: add thread names to deadlock debugging message (James O'Beirne)
383b186c28 threads: prefix log messages with thread names (James O'Beirne)
ddd95ccb80 tests: add threadutil tests (James O'Beirne)
ae5f2b6a6c threads: introduce util/threadnames, refactor thread naming (James O'Beirne)
188ca75e5f disable HAVE_THREAD_LOCAL on unreliable platforms (James O'Beirne)
Pull request description:
I'm resurrecting this one (from #13168) because I need it to make progress on #15735.
It's now off by default and can be turned on with `-logthreadnames=1`.
Ran some benchmarks (IBD from local peer from 500_000 -> 504_000) and it's within spitting distance either on or off:
### threadnames off (default)
#### 2018-05-threadnames.3 vs. master (absolute)
| name | iterations | 2018-05-threadnames.3 | master |
|------------------------------------------------|-----------:|----------------------------|----------------------------|
| ibd.local.500000.504000.dbcache=2048 | 3 | 376.1584 (± 9.2944) | 392.3414 (± 13.4238) |
| ibd.local.500000.504000.dbcache=2048.mem-usage | 3 | 2236117.3333 (± 1845.9623) | 2238690.6667 (± 2669.3487) |
#### 2018-05-threadnames.3 vs. master (relative)
| name | iterations | 2018-05-threadnames.3 | master |
|------------------------------------------------|-----------:|----------------------:|-------:|
| ibd.local.500000.504000.dbcache=2048 | 3 | 1 | 1.043 |
| ibd.local.500000.504000.dbcache=2048.mem-usage | 3 | 1 | 1.001 |
### threadnames on
#### 2018-05-threadnames-take-2 vs. master (absolute)
| name | iterations | 2018-05-threadnames-take-2 | master |
|------------------------------------------------|-----------:|----------------------------|----------------------------|
| ibd.local.500000.504000.dbcache=2048 | 3 | 367.6861 (± 0.3941) | 364.1667 (± 0.9776) |
| ibd.local.500000.504000.dbcache=2048.mem-usage | 3 | 2238461.3333 (± 3697.8730) | 2237014.6667 (± 3307.6966) |
#### 2018-05-threadnames-take-2 vs. master (relative)
| name | iterations | 2018-05-threadnames-take-2 | master |
|------------------------------------------------|-----------:|---------------------------:|-------:|
| ibd.local.500000.504000.dbcache=2048 | 3 | 1.010 | 1.00 |
| ibd.local.500000.504000.dbcache=2048.mem-usage | 3 | 1.001 | 1.00 |
```
ACKs for commit 8722e5:
Empact:
utACK https://github.com/bitcoin/bitcoin/pull/15849/commits/8722e54e56fd959fd4ff2321b36a7640dee440c5
jnewbery:
utACK 8722e54e56fd959fd4ff2321b36a7640dee440c5
MarcoFalke:
re-utACK 8722e54e56fd959fd4ff2321b36a7640dee440c5 (Only change since my previous review is DEFAULT_LOGTHREADNAMES=false and stylistic updates
Tree-SHA512: 50af992708295b8d680cf10025262dd964e599a356bdfc1dfc84fb18c00afabcb34d3d12d551b0677ff81f8fccad0e17c1d5b24dfecb953a913bc77fdd1a4577
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index c0b3243c8d..d8c8e638ce 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -48,6 +48,7 @@ #include <future> #include <sstream> +#include <string> #include <boost/algorithm/string/replace.hpp> #include <boost/thread.hpp> @@ -1669,8 +1670,8 @@ static bool WriteUndoDataForBlock(const CBlockUndo& blockundo, CValidationState& static CCheckQueue<CScriptCheck> scriptcheckqueue(128); -void ThreadScriptCheck() { - RenameThread("bitcoin-scriptch"); +void ThreadScriptCheck(int worker_num) { + util::ThreadRename(strprintf("scriptch.%i", worker_num)); scriptcheckqueue.Thread(); } |