Frame profiler
Go to file
Bartosz Taudul 9f2ffb05ac
Check if memory can be allocated in a thread.
Consider running the following code with operator new and delete overloaded to
track allocations with call stacks:

std::thread( []({ thread_local std::string str; });

Each call stack requires a memory allocation to be performed by the profiler,
to make the stack available at a later time. When the thread is created, the
TLS block is initialized and the std::string buffer can be allocated. To track
this allocation, rpmalloc has to be initialized. This initialization also
happens within the TLS block.

Now, when the thread exits, the heap managed by rpmalloc may be released first
during the TLS block destruction (and if the destruction is performed in
reverse creation order, then it *will* be destroyed first, as rpmalloc was
initialized only after the std::string initialization, to track the allocation
performed within). The next thing to happen is destruction of std::string and
release of the memory block it contains.

The release is tracked by the profiler, and as mentioned earlier, to save the
call stack for later use, a memory allocation is needed. But the allocator is
no longer available in this thread, because rpmalloc was released just before!

As a solution to this issue, profiler will detect whether the allocator is
still available and will ignore the call stack, if it's not. The other
solution is to disable the rpmalloc thread cleanup, which may potentially
cause leak-like behavior, in case a large number of threads is spawned and
destroyed.

Note that this is not a water-tight solution. Other functions will still want
to allocate memory for call stacks, but it is rather unlikely that such calls
would be performed during TLS block destruction. It is also possible that the
event queue will run out of allocated space for events at this very moment,
and in such a case the allocator will also fail.
2022-02-14 17:55:46 +01:00
.github Update to MSVC 2022. 2021-11-13 00:49:26 +01:00
.vscode Add minimal vscode configuration. 2020-08-15 02:10:14 +02:00
capture Make capture output better suited for 80-char-wide terminals. 2021-12-30 16:21:25 +01:00
client Check if memory can be allocated in a thread. 2022-02-14 17:55:46 +01:00
common Move TRACY_UWP define to own header 2022-02-10 20:26:45 +01:00
csvexport Bump zstd to 1.5.1. 2021-12-21 12:22:42 +01:00
doc Update second screenshot. 2021-01-22 02:54:01 +01:00
examples remove blocking collect 2022-01-28 11:55:42 +08:00
extra Update to MSVC 2022. 2021-11-13 00:49:26 +01:00
getopt Move getopt to root 2020-07-11 12:26:01 +03:00
icon Recompress public facing PNG images. 2020-09-24 01:31:24 +02:00
imgui Backport 19471da from ImGui. 2022-02-03 01:59:56 +01:00
import-chrome Bump zstd to 1.5.1. 2021-12-21 12:22:42 +01:00
libbacktrace Update libbacktrace to d0f5e95. 2021-07-25 12:34:11 +02:00
library Update to MSVC 2022. 2021-11-13 00:49:26 +01:00
manual Add UWP platform limitations to manual 2022-02-11 14:14:27 +01:00
nfd Set owner of file dialogs on windows. 2020-06-10 01:52:17 +02:00
profiler Update to Font Awesome 6. 2022-02-08 21:27:51 +01:00
server Fix edge case triggered by mouse being out-of-window. 2022-01-29 15:53:50 +01:00
test Drop support for Cygwin. 2021-10-07 23:28:40 +02:00
update Bump zstd to 1.5.1. 2021-12-21 12:22:42 +01:00
vcpkg Add -disableMetrics to vcpkg script 2020-05-02 14:52:57 -07:00
zstd Bump zstd to 1.5.1. 2021-12-21 12:22:42 +01:00
.gitignore Add build automation script. 2021-02-06 23:57:14 +01:00
AUTHORS Update AUTHORS. 2022-02-11 20:22:53 +01:00
CMakeLists.txt Merge pull request #326 from Lectem/install_namepace 2022-02-12 01:14:52 +01:00
LICENSE Update copyright date in LICENSE. 2022-01-01 17:43:38 +01:00
meson.build Add meson.build 2021-06-24 22:41:50 +03:00
NEWS Update NEWS. 2022-02-11 20:21:32 +01:00
README.md Bundle links in README including latest documentation 2021-08-01 23:48:45 +02:00
TODO Add TODO. 2020-01-08 18:16:17 +01:00
Tracy.hpp Add fiber support on client side. 2021-11-02 00:11:09 +01:00
TracyC.h Added IsConnected C API Equivalent 2021-12-04 16:55:41 +00:00
TracyClient.cpp Merge remote-tracking branch 'origin/master' into hw 2021-06-02 01:12:28 +02:00
TracyD3D11.hpp Check if rpmalloc has to be initialized before each operation. 2021-05-31 02:31:42 +02:00
TracyD3D12.hpp Actually check for the required feature 2022-01-22 11:24:59 +02:00
TracyLua.hpp Implement callstack serialization. 2021-10-10 16:14:17 +02:00
TracyOpenCL.hpp remove blocking collect 2022-01-28 11:55:42 +08:00
TracyOpenGL.hpp Update TracyOpenGL.hpp 2021-11-04 10:46:13 +01:00
TracyVulkan.hpp VK_TIME_DOMAIN_MAX_ENUM_EXT may be undefined. 2021-12-23 21:40:19 +01:00

Tracy Profiler

Sponsor

A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.

Tracy supports profiling CPU (C, C++11, Lua), GPU (OpenGL, Vulkan, OpenCL, Direct3D 11/12), memory, locks, context switches, per-frame screenshots and more.

  • Documentation for usage and build process instructions
  • Releases containing the documentation (tracy.pdf) and compiled Windows x64 binaries (Tracy-<version>.7z) as assets
  • Changelog

Introduction to Tracy Profiler v0.2
New features in Tracy Profiler v0.3
New features in Tracy Profiler v0.4
New features in Tracy Profiler v0.5
New features in Tracy Profiler v0.6
New features in Tracy Profiler v0.7