How does it work?

Inner workings of MTuner

MTuner records memory operations with additional information useful for profiling (stack trace, time, size, etc.). The additional information is included for each memory operation that occurs during profiling. Needless to say, this generates large amounts of data that are stored in a capture file (*.MTuner). There are several internal techniques to reduce the amount of data stored in capture files, including LZ4 compression that is enabled by default.

There are two ways to generate the capture files – with and without instrumentation. In non-instrumented mode, MTuner injects the process of profiled application and hooks low level system allocation functions. For applications built with GCC and Clang toolchain, an additional option is to wrap memory allocations during linking process. An example how to achieve this is supplied with the MTuner SDK. In instrumented mode, allocations are marked explicitly by the user and no hooking or link time wrapping is required.

The main advantage of auto-instrumented profiling is that it is very simple to get started, within minutes after installation. Instrumentation also allows MTuner to capture allocations from dynamically libraries (DLLs). Manual instrumentation requires small initial work, but provides additional flexibility and two more features – marking timed events and adding memory tag trees. Supporting cross compilers and other platforms is currently only supported through manual instrumentation. For more information see the Instrumentation API section.