Skip to content

Conversation

@enetheru
Copy link
Contributor

This PR builds upon #112707 as it also requires utf8 strings interned for the duration of the process.

Adding the macro GodotProfileSetThreadName called from Thread::set_name() function.
This will give us all the "WorkerThread %d" names.
I have experimented with adding names to any thread function I could find, but found once the initial name is set, it will not adopt a new one, so in most cases where thread workers are used it is pointless.

I did not submit names for threads that don't use the threadworker pool as I didnt want to increase the surface area of this PR.

- GodotProfileVarname to make naming consistent
- GodotProfileZoneV to have control over the tracy zone variable name.
- GodotProfileZoneScript, to feed tracy custom source information
- GodotProfileZoneRename, to rename existing zones

Added intern_string functions to save String to utf8 conversions
- it saves ~30% of time.
- enables stable converted string locations for dynamic objects

Tracy macros want either static const char * pointers, or a pointer with size, so the CharIntern class, will convert or keep forever any String or CharString respectively, and pass through const char *
with tracy implementation that hooks into Thread::set_name
@enetheru enetheru requested review from a team as code owners November 18, 2025 06:55
@enetheru
Copy link
Contributor Author

wut, this error is completely unrelated to my code. Which probably means something is messing with memory somewhere, either because of me, or pre-existing me.

@Ivorforce
Copy link
Member

Don't worry about the test. The SVG test is flaky and randomly fails sometimes. I've restarted it, it shouldn't fail again.

@deralmas
Copy link
Contributor

Hi, doesn't tracy already pick up the thread name by its own? I did some testing early on in the tracy PR and, on Linux, as long as the thread name was short enough to make the threading library happy, it worked. Maybe something changed or is platform-specific?

@enetheru
Copy link
Contributor Author

Hi, doesn't tracy already pick up the thread name by its own? I did some testing early on in the tracy PR and, on Linux, as long as the thread name was short enough to make the threading library happy, it worked. Maybe something changed or is platform-specific?

yeah if the system supports it and the name is set by the sofware. You're right that this is a little redundant, but i wanted to keep the introductions lite, there is an additional grouping integer that can be added which notifies the tracy frontend to group the threads, but i didnt want to get into that without more knowledge.

@deralmas
Copy link
Contributor

I understand now, thank you for the clarification :D

IMO, the more we can integrate with tracy in the long run, the better. It truly is a very nifty tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants