mirror of
https://github.com/wolfpld/tracy.git
synced 2026-06-08 00:23:47 +00:00
Extension point so private/unsupported platforms can plug in their own implementations of the kernel/libc primitives Tracy depends on, without patching the `#if`/`#elif` chains. Projects supply a platform header via `-DTRACY_PLATFORM_HEADER="\"my_platform.h\""` at build time. Tracy includes it in any TU that needs the hooks. The header toggles per-category `TRACY_HAS_CUSTOM_*` macros and declares matching `tracy::Platform*` functions. Available hooks: - `TRACY_HAS_CUSTOM_THREAD_ID` → `PlatformGetThreadId` - `TRACY_HAS_CUSTOM_USER_INFO` → `PlatformGetHostname`, `PlatformGetUserLogin`, `PlatformGetUserFullName` - `TRACY_HAS_CUSTOM_SAFE_COPY` → `PlatformSafeMemcpy` - `TRACY_HAS_CUSTOM_ALLOCATOR` → `PlatformMalloc`, `PlatformFree`, `PlatformRealloc`, `PlatformAllocatorInit`, `PlatformAllocatorThreadInit`, `PlatformAllocatorFinalize`, `PlatformAllocatorThreadFinalize` Each hook is wired as the first arm of its respective `#if`/`#elif` chain, so existing supported platforms are unaffected. Template files in `examples/CustomPlatform/` and a new subsection in `manual/tracy.tex` document the mechanism.
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
//
|
|
// Tracy profiler
|
|
// ----------------
|
|
//
|
|
// For fast integration, compile and
|
|
// link with this source file (and none
|
|
// other) in your executable (or in the
|
|
// main DLL / shared object on multi-DLL
|
|
// projects).
|
|
//
|
|
|
|
// Define TRACY_ENABLE to enable profiler.
|
|
|
|
#include "common/TracySystem.cpp"
|
|
|
|
#ifdef TRACY_ENABLE
|
|
|
|
#ifdef _MSC_VER
|
|
# pragma warning(push, 0)
|
|
#endif
|
|
|
|
#include "common/tracy_lz4.cpp"
|
|
#include "client/TracyProfiler.cpp"
|
|
#include "client/TracyCallstack.cpp"
|
|
#include "client/TracySysPower.cpp"
|
|
#include "client/TracySysTime.cpp"
|
|
#include "client/TracySysTrace.cpp"
|
|
#include "common/TracySocket.cpp"
|
|
#ifndef TRACY_HAS_CUSTOM_ALLOCATOR
|
|
#include "client/tracy_rpmalloc.cpp"
|
|
#endif
|
|
#include "client/TracyDxt1.cpp"
|
|
#include "client/TracyAlloc.cpp"
|
|
#include "client/TracyOverride.cpp"
|
|
#include "client/TracyKCore.cpp"
|
|
|
|
#ifdef TRACY_ROCPROF
|
|
# include "client/TracyRocprof.cpp"
|
|
#endif
|
|
#ifdef _MSC_VER
|
|
# pragma comment(lib, "ws2_32.lib")
|
|
# pragma comment(lib, "advapi32.lib")
|
|
# pragma comment(lib, "user32.lib")
|
|
# pragma warning(pop)
|
|
#endif
|
|
|
|
#endif
|