Profiling

guernika
Posts: 18
Joined: Fri May 07, 2010 2:20 pm

Profiling

Post by guernika »

Dear all,

I am trying to make some profiling, but I am not sure I understood correctly the profiler in bullet.
Let's say I have to measure:
- total time since the beginning
- total time of the current iteration
- time of only the performCollisionDetection profiling section

I wrote this lines:

Code: Select all


void cbIdle()
{
	g_world->stepSimulation(0.001,0);
	CProfileIterator* profile_iterator = CProfileManager::Get_Iterator();
	gTotalTime = profile_iterator->Get_Current_Total_Time();
	profile_iterator->Enter_Child(0);	
	profile_iterator->Enter_Child(2);
	profile_iterator->Enter_Child(5);
	gPartialTime = profile_iterator->Get_Current_Parent_Total_Time();
	gAccumulatedTime += gTotalTime;
	printf("accumulated time: %2.3f - total time: %2.3f -  %s: %2.3f\n", 
			 gAccumulatedTime, gTotalTime, profile_iterator->Get_Current_Parent_Name(), gPartialTime);
	glutPostRedisplay();
}
I get an output like this:

accumulated time: 561.027 - total time: 0.270 - performDiscreteCollisionDetection: 0.081

Is it correct?

Thanks in advance

Francesco