Tracy - a Profiling Dev Tool
First of all, Tracy is a real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.
This issue is a proposal to integrate Tracy inside the Aidge Platform. This will give us a great way to dissect how a program is running and how resources are used. It is a major step toward optimizing performance and identifying bottlenecks. Tracy provides real-time, low-overhead profiling that's far superior to traditional debuggers and logging methods.
-
Exceptional Performance: Unlike other profilers that can significantly slow down an application, Tracy is designed for minimal overhead. This means we can leave it running in production without a substantial performance hit, allowing for continuous monitoring and a clear view of real-world performance issues.
-
Intuitive Visualization: Tracy's main strength lies in its highly detailed, easy-to-read, and interactive timeline view. This visualization allows developers to quickly spot frame drops, excessive memory allocations, and long-running tasks at a glance.
- Development Dependency only. I could make it so Tracy is a toggleable development dependency. We could even add it to export to see how they run.
Key Changes
-
Aidge - CMake Kit will provide a toggleable dev dependency
- Targets can link to it, every thing else we'll be taken care of by ACK
- A generated header will be available to introduce Tracy API, where functions will be resolved to no-op if Tracy is disabled (it won't even need to link to Tracy.)
aidge/tracy.hpp
Some Notes
- To be able to use tracy, the following variables must be set during build time :
TRACY_ENABLE ONTRACY_NO_EXIT ON
- Tracy functions can already be removed from builds by setting
TRACY_ENABLEtoON. Having the generated header from ACK is just a wrapper to be able to not link to it, if we are not using it. If for any reason, this is uncessary, feel free to remove the wrapper.
Some ScreenShots
Notable Features
Add your own plots
You can add your own plots very easily with these two macros :
TracyPlotConfig(name,
format, step, fill, color)
TracyPlot(name, value)
See the manual section 3.6 Plotting Data for more information.
Logger
Tracy provide a convenient way to read/search/inspect logs. I could refactor the logger to also send them to Tracy if it is enabled.
System Power Usage (only on Linux)
Added in version 0.10.
CPU Topology Die
Added in version 0.12.
Resources
Example
Tracy was integrated in a test export using a convolution. The trace is available here if you want to look at it by yourself : conv_test_export_cpp.tracy
Note
On windows, you can simply download and launch the profiler. On Unix & MacOS, you need to build it from source.
Just in case, some screenshots are also available below:

Warning
Export don't compile on windows, even with the clang-cl variant. They only compile with GCC. Furthermore, Makefile is not cross-platform (does not work on windows).
Example workflow to integrate tracy into export
- Instead of a makefile, change it to a cmake project
a. Write a
CMakeLists.txtb. Addacm.cmakeand include it. c. Link export withAidge::instrumentation - Configure & build with
-DTRACY_ENABLE=1 -DTRACY_NO_EXIT=1 - Annotate code with relevant Tracy markup
- Launch Tracy Profiler and click
Connect - Launch your export
TODO Tasks
-
Integrate into backend_opencv -
Integrate into backend_cuda- This is blocked by issue #322.
-
Integrate into export - This is blocked by issue #1216
-
Integrate into build systems -
Instrument Layer
-
Fix memory allocation to track be able to track them. - Tracy reports errors on how Aidge manages memory (double free?)








