3#include <Foundation/Basics.h>
4#include <Foundation/Containers/DynamicArray.h>
5#include <Foundation/Containers/StaticRingBuffer.h>
6#include <Foundation/System/Process.h>
7#include <Foundation/Time/Time.h>
24 const char* m_szFunction;
43 PL_FOUNDATION_DLL
static void StartNextSection(
plStringView sNextSectionName);
51 const char* m_szListFunction;
55 plTime m_CurSectionBeginTime;
64 plUInt64 m_uiThreadId;
70 PL_DECLARE_POD_TYPE();
72 static constexpr plUInt32 NAME_SIZE = 40;
74 const char* m_szFunctionName;
77 char m_szName[NAME_SIZE];
83 plUInt64 m_uiThreadId = 0;
89 PL_DECLARE_POD_TYPE();
91 static constexpr plUInt32 NAME_SIZE = 48;
95 char m_szName[NAME_SIZE];
100 plUInt32 m_uiFramesThreadID = 0;
101 plUInt32 m_uiProcessSortIndex = 0;
102 plOsProcessID m_uiProcessID = 0;
108 plUInt64 m_uiFrameCount = 0;
128 static void SetDiscardThreshold(
plTime threshold);
136 static void StartNewFrame();
145 PL_MAKE_SUBSYSTEM_STARTUP_FRIEND(Foundation, ProfilingSystem);
146 friend plUInt32 RunThread(
plThread* pThread);
148 static void Initialize();
156 static void RemoveThread();
160 static void InitializeGPUData(plUInt32 uiGpuCount = 1);
166#if PL_ENABLED(PL_USE_PROFILING) || defined(PL_DOCS)
177# define PL_PROFILE_SCOPE(ScopeName) \
178 plProfilingScope PL_PP_CONCAT(_plProfilingScope, PL_SOURCE_LINE)(ScopeName, PL_SOURCE_FUNCTION, plTime::MakeZero())
185# define PL_PROFILE_SCOPE_WITH_TIMEOUT(ScopeName, Timeout) \
186 plProfilingScope PL_PP_CONCAT(_plProfilingScope, PL_SOURCE_LINE)(ScopeName, PL_SOURCE_FUNCTION, Timeout)
199# define PL_PROFILE_LIST_SCOPE(ListName, FirstSectionName) \
200 plProfilingListScope PL_PP_CONCAT(_plProfilingScope, PL_SOURCE_LINE)(ListName, FirstSectionName, PL_SOURCE_FUNCTION)
206# define PL_PROFILE_LIST_NEXT_SECTION(NextSectionName) \
207 plProfilingListScope::StartNextSection(NextSectionName)
210# define PL_PROFILER_FRAME_MARKER()
213# define PL_PROFILE_SCOPE(ScopeName)
214# define PL_PROFILE_SCOPE_WITH_TIMEOUT(ScopeName, Timeout)
215# define PL_PROFILE_LIST_SCOPE(ListName, FirstSectionName)
216# define PL_PROFILE_LIST_NEXT_SECTION(NextSectionName)
217# define PL_PROFILER_FRAME_MARKER()
221#include <Foundation/Profiling/Profiling_Tracy.h>
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
Definition DynamicArray.h:81
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
This class implements a profiling scope similar to plProfilingScope, but with additional sub-scopes w...
Definition Profiling.h:38
This class encapsulates a profiling scope.
Definition Profiling.h:17
Helper functionality of the profiling system.
Definition Profiling.h:60
static plUInt64 GetFrameCount()
Get current frame counter.
static void SetScopeTimeoutCallback(ScopeTimeoutDelegate callback)
Sets a callback that is triggered when a profiling scope takes longer than desired.
Interface for binary out (write) streams.
Definition Stream.h:107
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
This class is the base class for platform independent long running threads.
Definition Thread.h:40
A generic delegate class which supports static functions and member functions.
Definition Delegate.h:76
Definition Profiling.h:69
Definition Profiling.h:81
Helper struct to hold GPU profiling data.
Definition Profiling.h:88
Definition Profiling.h:99
Definition Profiling.h:63
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12