Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name threads in the programs #6997

merged 10 commits into from Oct 4, 2018


Copy link

@pieterlexis pieterlexis commented Sep 27, 2018

Short description

This PR adds names to our progam's threads. These show up in ps -eT and in certain htop configuration. They might help users (and us) to figure out where the bottleneck in an application exists.

Closes #6974

Tested on

  • Linux
  • FreeBSD
  • Mac/Darwin
  • NetBSD
  • OpenBSD


I have:

  • read the document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)
pieterlexis added 5 commits Sep 27, 2018
Copy link
Member Author

@pieterlexis pieterlexis commented Sep 27, 2018

Reading the diff, I think a threadname.hh with a setThreadname function would help :)

@@ -34,6 +34,11 @@
void* carbonDumpThread(void*)
string threadName = "pdns/carbonDump";
auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));

This comment has been minimized.


chbruyand Sep 27, 2018

By curiosity, why do you remove constness of the name argument everywhere ?

Copy link

@rgacogne rgacogne commented Sep 27, 2018

Note that the _np suffix stands for non-portable, so we should probably check that the function is available during configure.

Copy link

@zeha zeha commented Sep 27, 2018

Note that on BSDs, the function has a different signature:

/usr/include/pthread.h:int	pthread_setname_np(const char*);
pieterlexis added 2 commits Sep 27, 2018
Copy link

@Habbie Habbie commented Sep 28, 2018

Note that on BSDs, the function has a different signature:

Actually that's the Darwin signature.. the BSDs have at least two other signatures. @pieterlexis has it under control!

pieterlexis added 3 commits Sep 28, 2018
@pieterlexis pieterlexis force-pushed the pieterlexis:thread-names branch from a1efda8 to f4703d4 Sep 28, 2018
@ahupowerdns ahupowerdns merged commit af5b8e4 into PowerDNS:master Oct 4, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
@pieterlexis pieterlexis deleted the pieterlexis:thread-names branch Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.