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
Fix thread naming on Linux and Darwin #13569
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I like it.
@FernetMenta, @notspiff I'm fine with this. It prefixes the thread names in GDB on pthreads supported systems. It's up to you guys. |
max chars is 15. do we have thread names > 13 that would be truncated by this change? |
Yes. But it only truncates a copy of the name, so it's not a change. |
assume there is a thread name with 15 characters. Currently it would show up in i.e. top as Not really nice but not a big issue either. Just wanted to know if we have those cases. |
Currently it would show up as "kodi" because the code has been broken for a few years already ;-) And a limit is a limit. Thread names > 15 characters will be truncated anyway, and I do not think anyone is paying attention to that at the moment. I think scratching two characters off the limit is worth for seeing which threads are kodi-owned and which are not. On Linux we have a lot of threads owned by libraries such as mesa, pulseaudio etc. Also no one even noticed that it did not work at all for quite some time, so impact should be very limited. |
I was usng this a lot as I worked on threads. You can configure top in a way that is shows all threads owned by an application tree-like under this app. I never felt the need for a prefix. |
Yes, that is exactly what this PR is for. Because it's been broken since the switch to CMake. The @FernetMenta approve the PR if you're ok with it :-) |
std::string pthreadName("k/"); | ||
pthreadName += m_ThreadName; | ||
// Limit on Linux is 15 chars + NULL | ||
pthreadName.resize(15); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
is this still waiting for something? |
@Rechi how's the OS X stuff? can you PR it? |
Added some years ago, #define got lost in autoconf -> cmake conversion.
Description
Added some years ago, #define got lost in
autoconf -> cmake conversion.
Motivation and Context
It's very useful during debugging to be able to distinguish all the threads.
How Has This Been Tested?
Build/run on Linux
Screenshots (if appropriate):
Types of change
Checklist: