Skip to content

Add support for the Tracy profiler#8418

Open
messmerd wants to merge 4 commits into
LMMS:masterfrom
messmerd:tracy-profiler
Open

Add support for the Tracy profiler#8418
messmerd wants to merge 4 commits into
LMMS:masterfrom
messmerd:tracy-profiler

Conversation

@messmerd

@messmerd messmerd commented Jun 1, 2026

Copy link
Copy Markdown
Member

Adds support for the popular Tracy Profiler.

The Tracy profiler is cross-platform, very easy-to-use, and has tons of features. However, it requires some instrumentation, which I've done in this PR.

Quick demo:

2026-05-31.22-47-23.mp4

Support can be enabled via the -DWANT_DEBUG_TRACY=ON config option. When enabled, the Tracy repo will be cloned and compiled automatically. Otherwise, there is no dependency on Tracy. All Tracy instrumentation code is a no-op when Tracy profiling is disabled.


The changes to the codebase are minimal:

  • I converted AudioEngineWorkerThread's QWaitCondition/QMutex usage to std::condition_variable (or std::condition_variable_any when using Tracy) / std::mutex in order for Tracy to profile them, though this wasn't strictly necessary.
  • I also added displayNameUtf8() methods for effects and instruments in order to pass a const char* to Tracy efficiently. This allows traces to contain the names of plugins so we can easily identify which plugins are performing well or performing poorly.

All other changes are Tracy instrumentation macros which I've added throughout the audio pipeline in order to collect useful performance information. Again, all these macros are no-ops when not using Tracy.


Through profiling, I noticed that the EnvelopeAndLfoParameters::fillLevel method was taking a lot of time to execute, and I was able to achieve a significant performance improvement in 95a3bae by moving a variable outside the loop. Here's the difference it made as measured by Tracy:
image

I'm sure Tracy will let us find and fix performance issues in many other places as well.

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.

1 participant