Photon Common Library
2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
profiling.h
Go to the documentation of this file.
1
#pragma once
2
7
#include "
Common/config.h
"
8
#include "
Common/macro.h
"
9
10
#include "
Common/ThirdParty/lib_tracy.h
"
11
12
#if PH_PROFILING
13
17
#define PH_DEFINE_PROFILE_UNIT_NAME(unitName)\
18
inline constexpr const char* internal_impl_profile_unit_name_##unitName = #unitName
19
20
#else
21
22
#define PH_DEFINE_PROFILE_UNIT_NAME(unitName)
23
24
#endif
25
26
#if PH_PROFILING && PH_THIRD_PARTY_HAS_TRACY
27
28
/*
29
Note on names used by Tracy: Some Tracy macros require unique names to have unique pointer, see
30
Tracy manual 3.1.2 "Unique pointers". `PH_DEFINE_PROFILE_UNIT_NAME()` meet the requirement.
31
Macro parameters named `unitName` require unique names. For any other name (macro parameters with a
32
`Str` suffix), see Tracy manual 3.1 "Handling text strings" more details (TL;DR: use literal for
33
names without a size parameter; otherwise the string data will be copied).
34
*/
35
36
#define PH_PROFILE_LOOP_MARK(unitName)\
37
FrameMarkNamed(internal_impl_profile_unit_name_##unitName)
38
39
#define PH_PROFILE_LOOP_BEGIN(unitName)\
40
FrameMarkStart(internal_impl_profile_unit_name_##unitName)
41
42
#define PH_PROFILE_LOOP_END(unitName)\
43
FrameMarkEnd(internal_impl_profile_unit_name_##unitName)
44
45
#define PH_PROFILE_SCOPE()\
46
ZoneScoped
47
48
#define PH_PROFILE_NAMED_SCOPE(nameStr)\
49
ZoneScopedN(nameStr)
50
51
#define PH_PROFILE_NAME_THIS_THREAD(threadNameStr)\
52
tracy::SetThreadName(threadNameStr)
53
54
#else
55
56
#define PH_PROFILE_LOOP_MARK(unitName) PH_NO_OP()
57
#define PH_PROFILE_LOOP_BEGIN(unitName) PH_NO_OP()
58
#define PH_PROFILE_LOOP_END(unitName) PH_NO_OP()
59
#define PH_PROFILE_SCOPE() PH_NO_OP()
60
#define PH_PROFILE_NAMED_SCOPE(nameStr) PH_NO_OP()
61
#define PH_PROFILE_NAME_THIS_THREAD(threadNameStr) PH_NO_OP()
62
63
#endif
config.h
Configurations for the entire toolset.
lib_tracy.h
macro.h
Useful macro definitions for general operations.
Include
Common
profiling.h
Generated by
1.11.0