rename to b3 convention, to avoid naming conflicts when using in combination with Bullet 2.x
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
/*
|
||||
Copyright (c) 2003-2013 Erwin Coumans http://bulletphysics.org
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
**
|
||||
@@ -27,9 +40,9 @@
|
||||
|
||||
|
||||
|
||||
#define USE_BT_CLOCK 1
|
||||
#define B3_USE_CLOCK 1
|
||||
|
||||
#ifdef USE_BT_CLOCK
|
||||
#ifdef B3_USE_CLOCK
|
||||
|
||||
///The b3Clock is a portable basic clock that measures accurate time in seconds, use for profiling.
|
||||
class b3Clock
|
||||
@@ -56,23 +69,23 @@ private:
|
||||
struct b3ClockData* m_data;
|
||||
};
|
||||
|
||||
#endif //USE_BT_CLOCK
|
||||
#endif //B3_USE_CLOCK
|
||||
|
||||
|
||||
|
||||
|
||||
///A node in the Profile Hierarchy Tree
|
||||
class CProfileNode {
|
||||
class b3ProfileNode {
|
||||
|
||||
public:
|
||||
CProfileNode( const char * name, CProfileNode * parent );
|
||||
~CProfileNode( void );
|
||||
b3ProfileNode( const char * name, b3ProfileNode * parent );
|
||||
~b3ProfileNode( void );
|
||||
|
||||
CProfileNode * Get_Sub_Node( const char * name );
|
||||
b3ProfileNode * Get_Sub_Node( const char * name );
|
||||
|
||||
CProfileNode * Get_Parent( void ) { return Parent; }
|
||||
CProfileNode * Get_Sibling( void ) { return Sibling; }
|
||||
CProfileNode * Get_Child( void ) { return Child; }
|
||||
b3ProfileNode * Get_Parent( void ) { return Parent; }
|
||||
b3ProfileNode * Get_Sibling( void ) { return Sibling; }
|
||||
b3ProfileNode * Get_Child( void ) { return Child; }
|
||||
|
||||
void CleanupMemory();
|
||||
void Reset( void );
|
||||
@@ -92,14 +105,14 @@ protected:
|
||||
unsigned long int StartTime;
|
||||
int RecursionCounter;
|
||||
|
||||
CProfileNode * Parent;
|
||||
CProfileNode * Child;
|
||||
CProfileNode * Sibling;
|
||||
b3ProfileNode * Parent;
|
||||
b3ProfileNode * Child;
|
||||
b3ProfileNode * Sibling;
|
||||
void* m_userPtr;
|
||||
};
|
||||
|
||||
///An iterator to navigate through the tree
|
||||
class CProfileIterator
|
||||
class b3ProfileIterator
|
||||
{
|
||||
public:
|
||||
// Access all the children of the current parent
|
||||
@@ -128,17 +141,17 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
CProfileNode * CurrentParent;
|
||||
CProfileNode * CurrentChild;
|
||||
b3ProfileNode * CurrentParent;
|
||||
b3ProfileNode * CurrentChild;
|
||||
|
||||
|
||||
CProfileIterator( CProfileNode * start );
|
||||
friend class CProfileManager;
|
||||
b3ProfileIterator( b3ProfileNode * start );
|
||||
friend class b3ProfileManager;
|
||||
};
|
||||
|
||||
|
||||
///The Manager for the Profile system
|
||||
class CProfileManager {
|
||||
class b3ProfileManager {
|
||||
public:
|
||||
static void Start_Profile( const char * name );
|
||||
static void Stop_Profile( void );
|
||||
@@ -153,20 +166,20 @@ public:
|
||||
static int Get_Frame_Count_Since_Reset( void ) { return FrameCounter; }
|
||||
static float Get_Time_Since_Reset( void );
|
||||
|
||||
static CProfileIterator * Get_Iterator( void )
|
||||
static b3ProfileIterator * Get_Iterator( void )
|
||||
{
|
||||
|
||||
return new CProfileIterator( &Root );
|
||||
return new b3ProfileIterator( &Root );
|
||||
}
|
||||
static void Release_Iterator( CProfileIterator * iterator ) { delete ( iterator); }
|
||||
static void Release_Iterator( b3ProfileIterator * iterator ) { delete ( iterator); }
|
||||
|
||||
static void dumpRecursive(CProfileIterator* profileIterator, int spacing);
|
||||
static void dumpRecursive(b3ProfileIterator* profileIterator, int spacing);
|
||||
|
||||
static void dumpAll();
|
||||
|
||||
private:
|
||||
static CProfileNode Root;
|
||||
static CProfileNode * CurrentNode;
|
||||
static b3ProfileNode Root;
|
||||
static b3ProfileNode * CurrentNode;
|
||||
static int FrameCounter;
|
||||
static unsigned long int ResetTime;
|
||||
};
|
||||
@@ -174,21 +187,21 @@ private:
|
||||
|
||||
///ProfileSampleClass is a simple way to profile a function's scope
|
||||
///Use the B3_PROFILE macro at the start of scope to time
|
||||
class CProfileSample {
|
||||
class b3ProfileSample {
|
||||
public:
|
||||
CProfileSample( const char * name )
|
||||
b3ProfileSample( const char * name )
|
||||
{
|
||||
CProfileManager::Start_Profile( name );
|
||||
b3ProfileManager::Start_Profile( name );
|
||||
}
|
||||
|
||||
~CProfileSample( void )
|
||||
~b3ProfileSample( void )
|
||||
{
|
||||
CProfileManager::Stop_Profile();
|
||||
b3ProfileManager::Stop_Profile();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#define B3_PROFILE( name ) CProfileSample __profile( name )
|
||||
#define B3_PROFILE( name ) b3ProfileSample __profile( name )
|
||||
|
||||
#else
|
||||
|
||||
|
||||
Reference in New Issue
Block a user