Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2008, 11:45:51 PM (16 years ago)
Author:
rgrieder
Message:

Updated to Bullet 2.73 (first part).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/bullet/LinearMath/btQuickprof.cpp

    r2192 r2430  
    111111        TotalCalls = 0;
    112112        TotalTime = 0.0f;
    113         gProfileClock.reset();
     113       
    114114
    115115        if ( Child ) {
     
    252252void    CProfileManager::Reset( void )
    253253{
     254        gProfileClock.reset();
    254255        Root.Reset();
    255256    Root.Call();
     
    279280}
    280281
     282#include <stdio.h>
     283
     284void    CProfileManager::dumpRecursive(CProfileIterator* profileIterator, int spacing)
     285{
     286        profileIterator->First();
     287        if (profileIterator->Is_Done())
     288                return;
     289
     290        float accumulated_time=0,parent_time = profileIterator->Is_Root() ? CProfileManager::Get_Time_Since_Reset() : profileIterator->Get_Current_Parent_Total_Time();
     291        int i;
     292        int frames_since_reset = CProfileManager::Get_Frame_Count_Since_Reset();
     293        for (i=0;i<spacing;i++) printf(".");
     294        printf("----------------------------------\n");
     295        for (i=0;i<spacing;i++) printf(".");
     296        printf("Profiling: %s (total running time: %.3f ms) ---\n",     profileIterator->Get_Current_Parent_Name(), parent_time );
     297        float totalTime = 0.f;
     298
     299       
     300        int numChildren = 0;
     301       
     302        for (i = 0; !profileIterator->Is_Done(); i++,profileIterator->Next())
     303        {
     304                numChildren++;
     305                float current_total_time = profileIterator->Get_Current_Total_Time();
     306                accumulated_time += current_total_time;
     307                float fraction = parent_time > SIMD_EPSILON ? (current_total_time / parent_time) * 100 : 0.f;
     308                {
     309                        int i;  for (i=0;i<spacing;i++) printf(".");
     310                }
     311                printf("%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());
     312                totalTime += current_total_time;
     313                //recurse into children
     314        }
     315
     316        if (parent_time < accumulated_time)
     317        {
     318                printf("what's wrong\n");
     319        }
     320        for (i=0;i<spacing;i++) printf(".");
     321        printf("%s (%.3f %%) :: %.3f ms\n", "Unaccounted:",parent_time > SIMD_EPSILON ? ((parent_time - accumulated_time) / parent_time) * 100 : 0.f, parent_time - accumulated_time);
     322       
     323        for (i=0;i<numChildren;i++)
     324        {
     325                profileIterator->Enter_Child(i);
     326                dumpRecursive(profileIterator,spacing+3);
     327                profileIterator->Enter_Parent();
     328        }
     329}
     330
     331
     332
     333void    CProfileManager::dumpAll()
     334{
     335        CProfileIterator* profileIterator = 0;
     336        profileIterator = CProfileManager::Get_Iterator();
     337
     338        dumpRecursive(profileIterator,0);
     339
     340        CProfileManager::Release_Iterator(profileIterator);
     341}
     342
     343
     344
    281345#endif //USE_BT_CLOCK
    282346
Note: See TracChangeset for help on using the changeset viewer.