-
-
Notifications
You must be signed in to change notification settings - Fork 23
Profiling
Mosaic has been instrumented with the Tracy Profiler which can be enabled using the MOSAIC_ENABLE_PROFILING and TRACY_ENABLE compiler flags.
Tracy offers a frame-based inspection, which gives an insight into the inner mechanics of Mosaic's underlying engine and its plugins. This can be useful for understanding the inner mechanics of Mosaic, spotting orchestration anomalies, bottlenecks or other bugs. It also visualises memory allocations over time which are useful for spotting memory leaks. Moreover, for more advanced users, Tracy is also great for visualising multi-threaded process orchestration order which are handy to spot race conditions or mutex bottlenecks.
Tracy comes in two parts. The client, which is embedded into Mosaic (and optionally compiled), sends profiling information using a standard network protocol. The profiler then collects and visualises the client data; it can run locally or on a remote computer, on the same network. Both versions have to be identical, the profiler will warn you if you use incompatible client version.
You can debug Mosaic running on any computer (Mac/Windows/Linux) with another (Linux) computer running the Profiler on the same network. If using a remote computer, an RJ45 connection is recommended over wifi.
For more information on different ways to use Tracy, checkout its manual.
The Tracy profiler is hard to compile on OSX, because it needs a quite modern compiler (C++17). Therefore (,on osx pre-10.12.6), it's recommended to compile (and run) it on Linux.
- Checkout which Tracy version your Mosaic distribution is using in
Mosaic/tracy/server/TracyVersion.hppand download that same version of Tracy, which also contains the profiler. In principle, the git submodule should always be in sync with your Mosaic version:git submodule update profiler/tracy. - Follow the profiler compilation procedure from the Tracy manual that you can find on the releases page.
// todo
// todo
Everything is almost ready, but you need to add a profiling build configuration to your build settings, so that Mosaic acts as a Tracy client.
Note: This may be either on the same or on another computer and/or operating system.
- Open Mosaic in Qt Creator, in the "Projects" section, select
Release, thenAdd > Clone Selectedand name it exactlyProfiling. - Change
ReleasetoProfilingin all fields below. (Build Directory,Configuration Name,Build Steps,Clean Steps) - You can now switch between 3 different build modes. Build the profiling one.
Compile Mosaic with -DTRACY_ENABLE -DTRACY_ONLY_IPV4 -DMOSAIC_ENABLE_PROFILING . See the current version of these lines as a reference.
Start the profiler, enter Mosaic's local IP address and connect. As soon as you launch Mosaic, it should start profiling.
[Todo]