Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracy Profiler Integration #33

Open
2 of 5 tasks
Daandelange opened this issue Sep 18, 2020 · 3 comments
Open
2 of 5 tasks

Tracy Profiler Integration #33

Daandelange opened this issue Sep 18, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@Daandelange
Copy link
Collaborator

Daandelange commented Sep 18, 2020

Opening a new issue for the Tracy integration, continuing the off-topic discussion from #22 .

So the idea is to integrate Tracy to facilitate debugging, with a focus on :

  • Data flow and order-of execution (plotting values, monitor execution times, mutex locks, etc,) frame by frame.
  • Memory usage (allocations, memory map, garbage collector, etc.)
  • GPU profiling on Linux + Windows.

Here's a screenshot from the 0.7.2 manual showing platform-specific features :
image


  • 0. Define where and how how to integrate it.
    I think it's important to keep Tracy as an optional build config : not everybody will need it, and as is seems to need recent system software to be able to inspect. What about a 3rd build option : Debug, DebugTracy, Release ?
    Later on, (special) release builds could also include it with a menu option to enable it, allowing remote debugging.

  • 1. Integrate the Tracy client into Mosaic/ofxVP. Easy : add submodule, include 1 file and set compile flag to enable.
    I have tested this with the Mosaic-Engine-Tester on a local branch. There seem to be some compile flags to set for better results (name stripping...). Also, they recommend not to run a client with a "debug config" regarding the associated compilation optimization flags.
    This makes Tracy send real-time Mosaic debug info over a network socket. (local by default)

  • 2. Compile the Tracy Profiler which allows to view & inspect the data.
    This seems as the easiest way to get started, there are more possibilities such as recording data for non-real-time debugging, and on-demand remote debugging.
    To build, you need to have a recent C++17 compiler. OSX 10.12.6 seems not possible. Maybe 10.13 with a more recent toolchain. I tried on a relatively old Linux Mint 16, with GCC 6.1, which should support C++17 but not with the needed extra features that Tracy uses. (Didn't try available workarounds yet.) So it looks like the Profiler needs a recent OS to be plug-and-play, compared to general OF/Mosaic capable setups.

  • 3. Fine-tune Tracy to our specific needs. Playing around with it will tell us. Probably some macros to add to get the best results, plus the optional-recommended macros to implement.

  • 4. Document usage.

@Daandelange Daandelange added the enhancement New feature or request label Sep 18, 2020
@Daandelange
Copy link
Collaborator Author

I got some time for this, it's quite easy to integrate but everything you collect is manual.
I'll definitely implement Tracy to facilitate #22. It will help optimize code, detect order-of-execution glitches, locks/mutexes that slow down threads, spot useless memory allocations, etc. And it might give an interactive insight of the inner mechanics of Mosaic for newcomers.

Here's 2 first screenshots to give an insight of what to expect.
Here, MosaicEngineTester ran on osx while the Tracy Profiler ran on Linux.
Tracy_profiler_mosaic_startup
Tracy_profiles_Mosaic_frameZoom
I'll add some details soon.

@d3cod3
Copy link
Owner

d3cod3 commented Nov 11, 2020

Great to hear it's working! Can't wait to have it running with Mosaic

@Daandelange
Copy link
Collaborator Author

Daandelange commented Jun 14, 2022

Side note: Tracy 0.8 brings a lot of multithreading-related updates, looks promising.

Edit: Current state:
Basic Tracy support has been added in c72c920 and 7de0753 . If I'm correct, all steps above still need to be checked, and some more Tracy features could be enabled.
There's also a Tracy Profiler Wiki with some initial instructions.

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

No branches or pull requests

2 participants