Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
lock.hpp
Go to the documentation of this file.
1/**
2 * @file tracy/lock.hpp
3 * @brief Tracy-specific mutex instrumentation macros.
4 *
5 * IMPORTANT: Lock profiling is Tracy-specific and bypasses the Profiler
6 * backend abstraction. These macros directly expand to Tracy's LockableBase /
7 * TracyLockable wrappers and cannot fan-out to other backends. Include this
8 * file only if Tracy is your primary profiling backend and you need lock
9 * contention visualization.
10 *
11 * Do NOT include this from profile.hpp or any header included by default.
12 */
13#pragma once
14
15#ifdef HELIOS_ENABLE_PROFILE
16
17#include <tracy/Tracy.hpp>
18
19// Tracy zone macros collide with helios::profile::Backend method names.
20#ifdef ZoneText
21#undef ZoneText
22#endif
23#ifdef ZoneValue
24#undef ZoneValue
25#endif
26#ifdef ZoneName
27#undef ZoneName
28#endif
29#ifdef ZoneColor
30#undef ZoneColor
31#endif
32#ifdef FrameMark
33#undef FrameMark
34#endif
35#ifdef FrameMarkNamed
36#undef FrameMarkNamed
37#endif
38#ifdef FrameMarkStart
39#undef FrameMarkStart
40#endif
41#ifdef FrameMarkEnd
42#undef FrameMarkEnd
43#endif
44
45#define HELIOS_PROFILE_LOCKABLE(type, var) TracyLockable(type, var)
46#define HELIOS_PROFILE_LOCKABLE_BASE(type) LockableBase(type)
47#define HELIOS_PROFILE_SHARED_LOCKABLE(type, var) TracySharedLockable(type, var)
48#define HELIOS_PROFILE_SHARED_LOCKABLE_BASE(type) SharedLockableBase(type)
49#define HELIOS_PROFILE_LOCK_MARK(lock) LockMark(lock)
50#define HELIOS_PROFILE_LOCK_NAME(lock, name) \
51 LockableName(lock, (name).data(), (name).size())
52
53#else
54
56
57#define HELIOS_PROFILE_LOCKABLE(type, var) type var
58#define HELIOS_PROFILE_LOCKABLE_BASE(type) type
59#define HELIOS_PROFILE_SHARED_LOCKABLE(type, var) type var
60#define HELIOS_PROFILE_SHARED_LOCKABLE_BASE(type) type
61#define HELIOS_PROFILE_LOCK_MARK(lock) \
62 [[maybe_unused]] static constexpr int HELIOS_ANONYMOUS_VAR(_helios_lock) = 0
63#define HELIOS_PROFILE_LOCK_NAME(lock, name) HELIOS_PROFILE_LOCK_MARK(lock)
64
65#endif