util: Make thread names shorter #16984

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:20190929-short-thread-names changing 1 files +1 −1
  1. hebasto commented at 7:05 pm on September 29, 2019: member

    Thread names at the process level are limited by 15 characters: https://github.com/bitcoin/bitcoin/blob/6b2210f1016c9ed96ce470e588e4cb12fa36a900/src/util/threadnames.cpp#L28-L29

    This commit ensures that name b-httpworker.42 will not be truncated.

    On master (6b2210f1016c9ed96ce470e588e4cb12fa36a900):

     0hebasto@redcat:~$ ps -T -p $(cat /home/hebasto/.bitcoin/testnet3/bitcoind.pid)
     1  PID  SPID TTY          TIME CMD
     232647 32647 pts/6    00:00:00 bitcoin-main
     332647 32648 pts/6    00:00:00 QXcbEventReader
     432647 32649 pts/6    00:00:00 bitcoin:disk$0
     532647 32650 pts/6    00:00:00 QDBusConnection
     632647 32651 pts/6    00:00:00 gmain
     732647 32652 pts/6    00:00:00 gdbus
     832647 32653 pts/6    00:00:07 bitcoin-qt-init
     932647 32656 pts/6    00:00:00 bitcoin-scriptc
    1032647 32657 pts/6    00:00:00 bitcoin-scriptc
    1132647 32658 pts/6    00:00:00 bitcoin-scriptc
    1232647 32659 pts/6    00:00:00 bitcoin-schedul
    1332647 32660 pts/6    00:00:00 bitcoin-http
    1432647 32661 pts/6    00:00:00 bitcoin-httpwor
    1532647 32662 pts/6    00:00:00 bitcoin-httpwor
    1632647 32663 pts/6    00:00:00 bitcoin-httpwor
    1732647 32664 pts/6    00:00:00 bitcoin-httpwor
    1832647 32665 pts/6    00:00:00 bitcoin-qt-init
    1932647 32668 pts/6    00:00:00 bitcoin-torcont
    2032647 32669 pts/6    00:00:00 bitcoin-upnp
    2132647 32670 pts/6    00:00:00 bitcoin-net
    2232647 32671 pts/6    00:00:00 bitcoin-dnsseed
    2332647 32672 pts/6    00:00:00 bitcoin-addcon
    2432647 32673 pts/6    00:00:00 bitcoin-opencon
    2532647 32674 pts/6    00:00:00 bitcoin-msghand
    2632647 32675 pts/6    00:00:00 QThread
    2732647 32676 pts/6    00:00:00 QThread
    

    With this PR:

     0hebasto@redcat:~$ ps -T -p $(cat /home/hebasto/.bitcoin/testnet3/bitcoind.pid)
     1  PID  SPID TTY          TIME CMD
     225664 25664 pts/0    00:00:00 b-main
     325664 25665 pts/0    00:00:00 QXcbEventReader
     425664 25666 pts/0    00:00:00 bitcoin:disk$0
     525664 25667 pts/0    00:00:00 QDBusConnection
     625664 25668 pts/0    00:00:00 gmain
     725664 25669 pts/0    00:00:00 gdbus
     825664 25670 pts/0    00:00:07 b-qt-init
     925664 25671 pts/0    00:00:00 b-scriptch.0
    1025664 25672 pts/0    00:00:00 b-scriptch.1
    1125664 25673 pts/0    00:00:00 b-scriptch.2
    1225664 25674 pts/0    00:00:00 b-scheduler
    1325664 25675 pts/0    00:00:00 b-http
    1425664 25676 pts/0    00:00:00 b-httpworker.0
    1525664 25677 pts/0    00:00:00 b-httpworker.1
    1625664 25678 pts/0    00:00:00 b-httpworker.2
    1725664 25679 pts/0    00:00:00 b-httpworker.3
    1825664 25680 pts/0    00:00:00 b-qt-init
    1925664 25682 pts/0    00:00:00 b-torcontrol
    2025664 25683 pts/0    00:00:00 b-upnp
    2125664 25684 pts/0    00:00:00 b-net
    2225664 25685 pts/0    00:00:00 b-dnsseed
    2325664 25686 pts/0    00:00:00 b-addcon
    2425664 25687 pts/0    00:00:00 b-opencon
    2525664 25688 pts/0    00:00:01 b-msghand
    2625664 25689 pts/0    00:00:00 QThread
    2725664 25690 pts/0    00:00:00 QThread
    
  2. DrahtBot added the label Utils/log/libs on Sep 29, 2019
  3. promag commented at 9:00 pm on September 29, 2019: member
    Concept ACK, b1?
  4. fanquake requested review from jamesob on Sep 29, 2019
  5. hebasto commented at 5:15 am on September 30, 2019: member

    b1?

    I was looking for two-characters string: b points to Bitcoin, and 1 is a distinct separator.

  6. laanwj commented at 7:16 am on September 30, 2019: member
    Concept ACK, no opinion on “b1” specifically but having non-cropped thread names would be nice.
  7. practicalswift commented at 9:09 am on September 30, 2019: contributor

    ACK c442646be76ef3ba8015781aebb0e55ab742e3c9 modulo:

    <bikeshedding> I find say b1scheduler a bit unpleasant to read – 1 looks a bit like l or I. Perhaps - is better as a separator?

    Making it b-scheduler instead of b1scheduler :) </bikeshedding>

  8. yusufsahinhamza commented at 9:15 am on September 30, 2019: contributor
    @hebasto, @practicalswift What about btc instead of b1?
  9. hebasto commented at 9:27 am on September 30, 2019: member

    What about btc instead of b1?

    btc length is 3 characters. It will require to make shorter other parts of thread name, e.g., httpworker

  10. util: Make thread names shorter
    Thread names at the process level are limited by 15 characters. This
    commit ensures that name 'b-httpworker.42' will not be cropped.
    386ae0f691
  11. hebasto force-pushed on Sep 30, 2019
  12. hebasto commented at 7:38 pm on September 30, 2019: member

    @promag @laanwj @practicalswift Thank you for your reviews.

    I find say b1scheduler a bit unpleasant to read – 1 looks a bit like l or I. Perhaps - is better as a separator? Making it b-scheduler instead of b1scheduler :)

    Done. PR description has been updated.

  13. MarcoFalke commented at 8:09 pm on September 30, 2019: member
    ACK 386ae0f6916d11d72022cc6f6b62bb2b82594f24 (skimmed the diff on GitHub)
  14. practicalswift commented at 9:02 pm on September 30, 2019: contributor
    ACK 386ae0f6916d11d72022cc6f6b62bb2b82594f24 – diff looks correct
  15. fanquake approved
  16. fanquake commented at 4:23 am on October 1, 2019: member

    ACK 386ae0f6916d11d72022cc6f6b62bb2b82594f24 - quickly tested on a Debian system.

     0ps -T -p $(cat /home/test/regtest/bitcoind.pid)
     1  PID  SPID TTY          TIME CMD
     2 5909  5909 ?        00:00:00 b-init
     3 5909  5910 ?        00:00:00 b-scriptch.0
     4 5909  5911 ?        00:00:00 b-scriptch.1
     5 5909  5912 ?        00:00:00 b-scriptch.2
     6 5909  5913 ?        00:00:00 b-scriptch.3
     7 5909  5914 ?        00:00:00 b-scheduler
     8 5909  5915 ?        00:00:00 b-http
     9 5909  5916 ?        00:00:00 b-httpworker.0
    10 5909  5917 ?        00:00:00 b-httpworker.1
    11 5909  5918 ?        00:00:00 b-httpworker.2
    12 5909  5919 ?        00:00:00 b-httpworker.3
    13 5909  5921 ?        00:00:00 b-torcontrol
    14 5909  5922 ?        00:00:00 b-net
    15 5909  5924 ?        00:00:00 b-addcon
    16 5909  5925 ?        00:00:00 b-opencon
    17 5909  5926 ?        00:00:00 b-msghand
    
  17. fanquake referenced this in commit 6e4f655391 on Oct 1, 2019
  18. fanquake merged this on Oct 1, 2019
  19. fanquake closed this on Oct 1, 2019

  20. jamesob commented at 1:38 pm on October 1, 2019: member
    Post-merge ACK
  21. hebasto deleted the branch on Oct 1, 2019
  22. deadalnix referenced this in commit 1232b0292c on Mar 24, 2020
  23. ftrader referenced this in commit 2ac5ab36d5 on Dec 1, 2020
  24. kittywhiskers referenced this in commit 452c26e390 on Nov 6, 2021
  25. kittywhiskers referenced this in commit 2ddfa2ec21 on Dec 5, 2021
  26. kittywhiskers referenced this in commit 0d3bc6f060 on Dec 5, 2021
  27. kittywhiskers referenced this in commit 6ef0ef65e3 on Dec 12, 2021
  28. kittywhiskers referenced this in commit 502a329214 on Dec 12, 2021
  29. kittywhiskers referenced this in commit adc3f0478c on Dec 12, 2021
  30. PastaPastaPasta referenced this in commit a7f5379e19 on Dec 12, 2021
  31. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 12:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me