scenefx icon indicating copy to clipboard operation
scenefx copied to clipboard

Add optional Tracy support

Open ErikReider opened this issue 5 months ago • 3 comments

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?
  • [x] Update README with profiling instructions? (root etc)
  • [ ] Optional that can be added here/at a later date:
    • [ ] Add TracyCAppInfo?
    • [x] 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:

  • https://github.com/wolfpld/tracy/releases/latest/download/tracy.pdf
  • https://www.youtube.com/watch?v=ghXk3Bk5F2U

ErikReider avatar Jun 30 '25 22:06 ErikReider

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

WillPower3309 avatar Jul 13 '25 03:07 WillPower3309

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 avatar Jul 13 '25 22:07 ErikReider

instead of HEAD the wrap should probably pin tracy to releases, so API doesn't break randomly

the-eater avatar Nov 07 '25 13:11 the-eater