1#include <OgreBulletDynamicsWorld.h>
2#include <OgrePlatform.h>
9#if OGRE_PLATFORM != OGRE_PLATFORM_WIN32
10 #define _snprintf snprintf
62 RecursionCounter( 0 ),
99 if ( child->
Name == name ) {
141 unsigned long int time;
293 unsigned long int time;
306 profileIterator->
First();
307 if (profileIterator->
Is_Done())
312 for (
int i = 0; i < spacing; i++)
314 output.append(
"----------------------------------\n");
315 for (
int i = 0; i < spacing; i++)
318 _snprintf(buffer, 1000,
"Profiling: %s (total running time: %.3f ms) ---\n", profileIterator->
Get_Current_Parent_Name(), parent_time);
319 output.append(buffer);
320 float totalTime = 0.f;
325 for (
int i = 0; !profileIterator->
Is_Done(); i++, profileIterator->
Next())
329 accumulated_time += current_total_time;
330 float fraction = parent_time > SIMD_EPSILON ? (current_total_time / parent_time) * 100 : 0.f;
331 for (
int j = 0; j < spacing; j++)
333 _snprintf(buffer, 1000,
"%d -- %s (%.2f %%) :: %.3f ms / frame (%d calls)\n", i, profileIterator->
Get_Current_Name(), fraction,(current_total_time / (
double)frames_since_reset), profileIterator->
Get_Current_Total_Calls());
334 output.append(buffer);
335 totalTime += current_total_time;
339 if (parent_time < accumulated_time)
341 output.append(
"what's wrong\n");
343 for (
int i = 0; i < spacing; i++)
345 _snprintf(buffer, 1000,
"%s (%.3f %%) :: %.3f ms\n",
"Unaccounted:", parent_time > SIMD_EPSILON ? ((parent_time - accumulated_time) / parent_time) * 100 : 0.f, parent_time - accumulated_time);
346 output.append(buffer);
348 for (
int i = 0; i < numChildren; i++)
An iterator to navigate through the tree.
int Get_Current_Total_Calls(void)
ProfileIterator(ProfileNode *start)
const char * Get_Current_Parent_Name(void)
const char * Get_Current_Name(void)
ProfileNode * CurrentParent
float Get_Current_Parent_Total_Time(void)
ProfileNode * CurrentChild
float Get_Current_Total_Time(void)
void Enter_Child(int index)
static void dumpRecursive(std::string &output, ProfileIterator *profileIterator, int spacing)
static float Get_Time_Since_Reset(void)
static void Stop_Profile(void)
static void Release_Iterator(ProfileIterator *iterator)
static void Start_Profile(const char *name)
static void Increment_Frame_Counter(void)
static int Get_Frame_Count_Since_Reset(void)
static unsigned long int ResetTime
static ProfileNode * CurrentNode
static void dumpAll(std::string &output)
static ProfileIterator * Get_Iterator(void)
A node in the Profile Hierarchy Tree.
ProfileNode(const char *name, ProfileNode *parent)
ProfileNode * Get_Child(void)
ProfileNode * Get_Sibling(void)
unsigned long int StartTime
ProfileNode * Get_Parent(void)
ProfileNode * Get_Sub_Node(const char *name)
const char * Get_Name(void)
ProfileSample(const char *name, bool advanced=true)
bool SBSIMPEXP enable_profiling
bool SBSIMPEXP enable_advanced_profiling
float Profile_Get_Tick_Rate(void)
void Profile_Get_Ticks(unsigned long int *ticks)
static oClock gProfileClock