Add memory profiling documentation.

This commit is contained in:
Bartosz Taudul 2018-06-22 00:15:50 +02:00
parent 3404d191f0
commit 63611403ff

View File

@ -1,6 +1,6 @@
# Tracy Profiler
Tracy is a real time, nanosecond resolution frame profiler that can be used for remote or embedded telemetry of your application. It can profile both CPU (C++, Lua) and GPU (OpenGL, Vulkan). It also can display locks held by threads and their interactions with each other.
Tracy is a real time, nanosecond resolution frame profiler that can be used for remote or embedded telemetry of your application. It can profile CPU (C++, Lua), GPU (OpenGL, Vulkan) and memory. It also can display locks held by threads and their interactions with each other.
![](doc/profiler.png)
@ -85,7 +85,7 @@ Similarly, you can use `TracySharedLockable`, `TracySharedLockableN` and `Shared
#### Plotting data
Tracy is able to capture and draw value changes over time. You may use it to analyse memory usage, draw call count, etc. To report data, use the `TracyPlot( name, value )` macro.
Tracy is able to capture and draw value changes over time. You may use it to analyse draw call count, number of performed queries, etc. To report data, use the `TracyPlot( name, value )` macro.
![](doc/plot.png)
@ -95,6 +95,18 @@ Fast navigation in large data set and correlation of zones with what was happeni
![](doc/messages.png)
#### Memory profiling
Tracy can monitor memory usage of your application. Knowledge about each performed memory allocation enables the following:
- Memory usage graph (like in massif, but fully interactable).
- List of active allocations at program exit (leak list).
- Visualization of memory map.
- Ability to rewind view of active allocations and memory map to any point of program execution.
- Information about memory statistics of each zone.
To mark memory events, use the `TracyAlloc( ptr, size )` and `TracyFree( ptr )` macros. Typically you would do that in overloads of `operator new` and `operator delete`.
#### Lua support
To profile Lua code using tracy, include the `tracy/TracyLua.hpp` header file in your Lua wrapper and execute `tracy::LuaRegister( lua_State* )` function to add instrumentation support. In your Lua code, add `tracy.ZoneBegin()` and `tracy.ZoneEnd()` calls to mark execution zones. Double check if you have included all return paths! Use `tracy.ZoneBeginN( name )` to set zone name. Use `tracy.ZoneText( text )` to set zone text. Use `tracy.Message( text )` to send messages.