IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
profiler.hxx
Go to the documentation of this file.
1
3
4#pragma once
5#include <ice/types.hxx>
6#include <ice/build/build.hxx>
7
8#if (ICE_PROFILE || ICE_DEVELOP) && !ISP_WEBAPP
9
10# define IPT_ENABLED 1
11
12 ISC_WARNING_PUSH
13 ISCW_CHECK_OPERATOR_PRECEDENCE(ISCW_OP_DISABLE)
14# define TRACY_ENABLE
15# define TRACY_IMPORTS
16# include <tracy/Tracy.hpp>
17# include <tracy/TracyC.h>
18# undef assert
19 ISC_WARNING_POP
20
21# define IPT_FRAME_MARK FrameMark
22# define IPT_FRAME_MARK_NAMED( ... ) FrameMarkNamed( __VA_ARGS__ )
23
24# define IPT_ZONE_SCOPED ZoneScoped
25# define IPT_ZONE_SCOPED_NAMED( ... ) ZoneScopedN( __VA_ARGS__ )
26# define IPT_ZONE_NAME_STR( str ) ZoneName( str.begin(), str.size() )
27
28# define IPT_ZONE_TEXT( txt, size ) ZoneText( txt, size )
29# define IPT_ZONE_TEXT_STR( str ) IPT_ZONE_TEXT( str.begin(), str.size() )
30
31# define IPT_ALLOC( ptr, size ) TracyAlloc( ptr, size )
32# define IPT_DEALLOC( ptr ) TracyFree( ptr )
33# define IPT_ALLOC_POOL( ptr, size, name ) TracyAllocN( ptr, size, name.begin() )
34# define IPT_DEALLOC_POOL( ptr, name ) TracyFreeN( ptr, name.begin() )
35
36# define IPT_MESSAGE( txt ) TracyMessage( txt, ice::count(txt) )
37# define IPT_MESSAGE_STR( txt ) TracyMessage( txt.begin(), txt.size() )
38
39
40# if defined(TRACY_FIBERS)
41# define IPT_FIBERS 1
42# define IPT_FIBER_START( name ) TracyFiberEnter( name )
43# define IPT_FIBER_END TracyFiberLeave
44# else
45# define IPT_FIBERS 0
46# define IPT_FIBER_START( name )
47# define IPT_FIBER_END
48# endif
49
50#else // #if ICE_PROFILE
51
52# define IPT_ENABLED 0
53
54# define IPT_FRAME_MARK
55# define IPT_FRAME_MARK_NAMED(...)
56
57# define IPT_ZONE_SCOPED
58# define IPT_ZONE_SCOPED_NAMED(...)
59# define IPT_ZONE_NAME_STR( str )
60
61# define IPT_ZONE_TEXT( txt, size )
62# define IPT_ZONE_TEXT_STR( str )
63
64# define IPT_ALLOC( ptr, size )
65# define IPT_DEALLOC( ptr )
66# define IPT_ALLOC_POOL( ptr, size, name )
67# define IPT_DEALLOC_POOL( ptr, name )
68
69# define IPT_MESSAGE( txt )
70# define IPT_MESSAGE_STR( txt )
71
72# define IPT_FIBERS 0
73# define IPT_FIBER_START( name )
74# define IPT_FIBER_END
75
76#endif // #if ICE_PROFILE
77
79{
80
81 static constexpr bool is_enabled = IPT_ENABLED;
82 static constexpr bool has_fiber_support = IPT_FIBERS;
83
84} // namespace ice::profiling
Definition profiler.hxx:79
static constexpr bool has_fiber_support
Definition profiler.hxx:82
static constexpr bool is_enabled
Definition profiler.hxx:81
#define IPT_FIBERS
Definition profiler.hxx:72
#define IPT_ENABLED
Definition profiler.hxx:52