Fetch thread names from ruby when outputting #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
It looks like nothing actually sets the thread name, so the tracks in firefox-profiler will not show any name:
Checking out the json file that is going into this, the thread name is "". If no name was every set, this is expected. However if a name was set, it is still not making it to the gecko output.
I originally suspected jhawthorn#46, but this is happening for me (on ruby 3.3.0) even with older gems (0.3.0, 0.3.1) that tried to get it from the pthread. In any case, the code to get this from the native extension is currently commented out and nothing seems to set it anywhere.
Proposed solution
Since we store the object id for the thread, we can use this to look up the thread and get its name.
If no name was ever set, I think it is still better to give the thread a name in the output so that the dropdown will be more intuitive. With this proposed change, here is what the output looks like:
The unnamed threads are distinguished by the thread's object id, which is kind of an arbitrary decision but seems like a reasonable default.