-
Notifications
You must be signed in to change notification settings - Fork 23
Profiling
Compiling Mosaic with Tracy enabled is considered for advanced users, probably already involved into developing Mosaic.
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. Both versions have to be identical, the profiler will warn you if you use incompatible client version.
- 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.
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.
Before continuing, it's a good idea to cross-read the Tracy manual that you can find as a .pdf
file on the releases page.
It contains very detailed information about how to implement and use Tracy, globally.
This wiki page is a quick-starting guide of the above manual, with some Mosaic related information added.
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.hpp
and 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 in section
4.2
.
// 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.
The platform being profiled will allow more or less data depending on its capabilities. Also, the performance hit on Osx is said to be larger then the other platforms, while still being useable. See section 2.1.6
and 3.0
in the Tracy manual for more details.
- Open Mosaic in Qt Creator, in the "Projects" section, select
Release
, thenAdd > Clone Selected
and name it exactlyProfiling
. - Change
Release
toProfiling
in 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.
Refer to section 2.2
of the Tracy manual for optimising the profiler results.
These are generally good to know when working with Tracy. In short : performance will vary depending on how you compile Mosaic and on what hardware-and-software configuration you run Mosaic on.
Start the profiler, enter Mosaic's local IP address and connect. As soon as you launch Mosaic, it should start profiling.
The network port used is 8086
by default (see 2.1.7
).
[Todo]
(refer to section 3.0
of the Tracy manual for detailed platform-dependent information)
- Scoped Zones (all platforms)
- CPU Load (all platforms)
- Memory allocations
- Mutex Locks (not yet)
- OpenGL Zones (windows+linux, not yet)