13 #ifndef BT_QUICK_PROF_H
14 #define BT_QUICK_PROF_H
17 #define USE_BT_CLOCK 1
64 #ifndef BT_ENABLE_PROFILE
65 #define BT_NO_PROFILE 1
86 CProfileNode(
const char* name, CProfileNode* parent);
89 CProfileNode* Get_Sub_Node(
const char* name);
91 CProfileNode* Get_Parent(
void) {
return Parent; }
92 CProfileNode* Get_Sibling(
void) {
return Sibling; }
93 CProfileNode* Get_Child(
void) {
return Child; }
100 const char* Get_Name(
void) {
return Name; }
101 int Get_Total_Calls(
void) {
return TotalCalls; }
102 float Get_Total_Time(
void) {
return TotalTime; }
103 void* GetUserPointer()
const {
return m_userPtr; }
104 void SetUserPointer(
void*
ptr) { m_userPtr =
ptr; }
110 unsigned long int StartTime;
111 int RecursionCounter;
113 CProfileNode* Parent;
115 CProfileNode* Sibling;
120 class CProfileIterator
127 bool Is_Root(
void) {
return (CurrentParent->Get_Parent() == 0); }
129 void Enter_Child(
int index);
130 void Enter_Largest_Child(
void);
131 void Enter_Parent(
void);
134 const char* Get_Current_Name(
void) {
return CurrentChild->Get_Name(); }
135 int Get_Current_Total_Calls(
void) {
return CurrentChild->Get_Total_Calls(); }
136 float Get_Current_Total_Time(
void) {
return CurrentChild->Get_Total_Time(); }
138 void* Get_Current_UserPointer(
void) {
return CurrentChild->GetUserPointer(); }
139 void Set_Current_UserPointer(
void*
ptr) { CurrentChild->SetUserPointer(
ptr); }
141 const char* Get_Current_Parent_Name(
void) {
return CurrentParent->Get_Name(); }
142 int Get_Current_Parent_Total_Calls(
void) {
return CurrentParent->Get_Total_Calls(); }
143 float Get_Current_Parent_Total_Time(
void) {
return CurrentParent->Get_Total_Time(); }
146 CProfileNode* CurrentParent;
147 CProfileNode* CurrentChild;
149 CProfileIterator(CProfileNode* start);
150 friend class CProfileManager;
154 class CProfileManager
157 static void Start_Profile(
const char* name);
158 static void Stop_Profile(
void);
160 static void CleanupMemory(
void);
165 static void Reset(
void);
166 static void Increment_Frame_Counter(
void);
167 static int Get_Frame_Count_Since_Reset(
void) {
return FrameCounter; }
168 static float Get_Time_Since_Reset(
void);
170 static CProfileIterator* Get_Iterator(
void);
175 static void Release_Iterator(CProfileIterator* iterator) {
delete (iterator); }
177 static void dumpRecursive(CProfileIterator* profileIterator,
int spacing);
179 static void dumpAll();
182 static int FrameCounter;
183 static unsigned long int ResetTime;
198 #define BT_PROFILE(name) CProfileSample __profile(name)
btAlignedObjectArray< btScalar > m_data
void() btLeaveProfileZoneFunc()
void btSetCustomEnterProfileZoneFunc(btEnterProfileZoneFunc *enterFunc)
btLeaveProfileZoneFunc * btGetCurrentLeaveProfileZoneFunc()
void btSetCustomLeaveProfileZoneFunc(btLeaveProfileZoneFunc *leaveFunc)
const unsigned int BT_QUICKPROF_MAX_THREAD_COUNT
unsigned int btQuickprofGetCurrentThreadIndex2()
void() btEnterProfileZoneFunc(const char *msg)
btEnterProfileZoneFunc * btGetCurrentEnterProfileZoneFunc()
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
CProfileSample(const char *name)
The btClock is a portable basic clock that measures accurate time in seconds, use for profiling.
btScalar getTimeSeconds()
unsigned long long int getTimeNanoseconds()
void reset()
Resets the initial reference time.
unsigned long long int getTimeMilliseconds()
unsigned long long int getTimeMicroseconds()
btClock()
The btClock is a portable basic clock that measures accurate time in seconds, use for profiling.
btClock & operator=(const btClock &other)
SyclQueue void void size_t num_bytes void