Skip to content

Conversation

@ErikReider
Copy link
Member

@ErikReider ErikReider commented Jun 30, 2025

Adds support for tracy which is used for advanced profiling! :D

Obligatory screenshot:
image

How to test it with tinywl, just add the -Dtracy_enable=true build option:

# scenefx/
meson subprojects download
meson setup build --buildtype=debugoptimized -Dtracy_enable=true --wipe
meson compile -C build
./build/tinywl/tinywl -s foot

And launch the separate tracy executable, which needs to be installed/compiled separately. The latest Wayland build is pretty broken on my system (crashes a lot...), so I compiled it with LEGACY=1, and run it through a separate terminal:

# tracy/
cmake -B profiler/build -S profiler -DCMAKE_BUILD_TYPE=Release -DLEGACY=1
cmake --build profiler/build --config Release --parallel
./profiler/build/tracy-profiler

Without the tracy_enable build option enabled (the default state), tracy support is completely disabled, so no overhead.

To test it with SwayFX, apply this patch and use the same build option to meson when setting up the project.

TODO:

  • Profile fewer/more rendering functions?
  • Add more CPU profiling to the wlr_scene functions
  • Use custom names instead of function names?
  • Update README with profiling instructions? (root etc)
  • Optional that can be added here/at a later date:
    • Add TracyCAppInfo?
    • Add messages?
    • Add Graphs?

Note: There's a tracy.wrap file in the subprojects directory which only gets automatically cloned when tracy is enabled through Meson.

Here's some documentation about how to use tracy:

@ErikReider ErikReider requested a review from WillPower3309 June 30, 2025 22:47
@ErikReider ErikReider self-assigned this Jun 30, 2025
@ErikReider ErikReider added the enhancement New feature or request label Jun 30, 2025
Copy link
Member

@WillPower3309 WillPower3309 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to do more #if TRACY_ENABLE. Ideally none of these changes would be hit if tracy is not enabled

@WillPower3309
Copy link
Member

Hey @ErikReider is this ready? Only thing I see is that we need to add those #if TRACY_ENABLEs

@ErikReider
Copy link
Member Author

Hey @ErikReider is this ready? Only thing I see is that we need to add those #if TRACY_ENABLEs

Oh, sorry, didn't see your original comment about that. There's one in the tracy.h file which is why there are so many macros. Makes it a lot more clean without 1000 preprocessor #if-statements

@ErikReider ErikReider requested a review from WillPower3309 July 13, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants