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

Meaningful thread names #1777

Closed
ABuch19 opened this issue Aug 10, 2020 · 3 comments
Closed

Meaningful thread names #1777

ABuch19 opened this issue Aug 10, 2020 · 3 comments

Comments

@ABuch19
Copy link

ABuch19 commented Aug 10, 2020

Short description

When you profile a complex application (several threads) it is very useful when you can identify threads in top by name.

Details

When you try to identify what part of a complex application is consuming CPU power, you might use top -p nn -H. Unfortunately all threads used by the mosquitto library will get the same name than the "main thread". So it is hard to identify, if mosquitto is causing the CPU load or another part of the application.

Implementation ideas

Mosquitto is creating some or more threads internally. Today they will not get a specific thread name.

Idea 1 - automatic thread naming

The Mosquitto functions could name all internal threads automatically, e.g. mq_mon, mq_obsrv, etc.

Idea 2 - access to thread IDs

The API could offer access to the IDs of the internal created threads. So the application could name all the threads according to its own naming convention.

Idea 3 - optional parameter with thread names

The API could offer optional initiailization parameters with thread names to be used for the Mosquitto internal threads.

@ralight
Copy link
Contributor

ralight commented Aug 10, 2020

This sounds like a perfectly reasonable request. How about for 1.6.11 we do 1, and for 1.7 we also do 2.

@ABuch19
Copy link
Author

ABuch19 commented Aug 10, 2020

Sounds good! I would be fine with 1.
But of course 2 would be more flexible - but would need some action from the application developer.
Maybe you could combine 1 and 2 for the 1.7? Set thread names by default, but optional the application could assign own thread names by using the thread IDs. I think most of the users would be happy with default thread-names. Only a minor number would like to give own thread names.

@ralight
Copy link
Contributor

ralight commented Aug 10, 2020

Agreed, that was what I mean by also doing 2 for 1.7.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants