Disable btQuickprof.h profiling by default. We use custom profiling functions, see b3ChromeUtilsStartTimings.

This commit is contained in:
erwincoumans
2018-11-01 08:19:50 -07:00
parent 336a4b65fe
commit 750133694c
5 changed files with 30 additions and 28 deletions

View File

@@ -251,7 +251,6 @@ void MyKeyboardCallback(int key, int state)
if (key == 'p') if (key == 'p')
{ {
#ifndef BT_NO_PROFILE
if (state) if (state)
{ {
b3ChromeUtilsStartTimings(); b3ChromeUtilsStartTimings();
@@ -260,7 +259,6 @@ void MyKeyboardCallback(int key, int state)
{ {
b3ChromeUtilsStopTimingsAndWriteJsonFile("timings"); b3ChromeUtilsStopTimingsAndWriteJsonFile("timings");
} }
#endif //BT_NO_PROFILE
} }
#ifndef NO_OPENGL3 #ifndef NO_OPENGL3
@@ -1129,6 +1127,7 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
gui2->registerFileOpenCallback(fileOpenCallback); gui2->registerFileOpenCallback(fileOpenCallback);
gui2->registerQuitCallback(quitCallback); gui2->registerQuitCallback(quitCallback);
} }
return true; return true;

View File

@@ -928,7 +928,7 @@ enum eFileIOTypes
}; };
//limits for vertices/indices in PyBullet::createCollisionShape //limits for vertices/indices in PyBullet::createCollisionShape
#define B3_MAX_NUM_VERTICES 1024 #define B3_MAX_NUM_VERTICES 16
#define B3_MAX_NUM_INDICES 1024 #define B3_MAX_NUM_INDICES 16
#endif //SHARED_MEMORY_PUBLIC_H #endif //SHARED_MEMORY_PUBLIC_H

View File

@@ -174,7 +174,7 @@ void MyEnterProfileZoneFunc(const char* msg)
{ {
if (gProfileDisabled) if (gProfileDisabled)
return; return;
#ifndef BT_NO_PROFILE
int threadId = btQuickprofGetCurrentThreadIndex2(); int threadId = btQuickprofGetCurrentThreadIndex2();
if (threadId < 0 || threadId >= BT_QUICKPROF_MAX_THREAD_COUNT) if (threadId < 0 || threadId >= BT_QUICKPROF_MAX_THREAD_COUNT)
return; return;
@@ -191,13 +191,13 @@ void MyEnterProfileZoneFunc(const char* msg)
gStartTimes[threadId][gStackDepths[threadId]] = 1 + gStartTimes[threadId][gStackDepths[threadId] - 1]; gStartTimes[threadId][gStackDepths[threadId]] = 1 + gStartTimes[threadId][gStackDepths[threadId] - 1];
} }
gStackDepths[threadId]++; gStackDepths[threadId]++;
#endif
} }
void MyLeaveProfileZoneFunc() void MyLeaveProfileZoneFunc()
{ {
if (gProfileDisabled) if (gProfileDisabled)
return; return;
#ifndef BT_NO_PROFILE
int threadId = btQuickprofGetCurrentThreadIndex2(); int threadId = btQuickprofGetCurrentThreadIndex2();
if (threadId < 0 || threadId >= BT_QUICKPROF_MAX_THREAD_COUNT) if (threadId < 0 || threadId >= BT_QUICKPROF_MAX_THREAD_COUNT)
return; return;
@@ -214,7 +214,7 @@ void MyLeaveProfileZoneFunc()
unsigned long long int endTime = clk.getTimeNanoseconds(); unsigned long long int endTime = clk.getTimeNanoseconds();
gTimings[threadId].addTiming(name, threadId, startTime, endTime); gTimings[threadId].addTiming(name, threadId, startTime, endTime);
#endif //BT_NO_PROFILE
} }
void b3ChromeUtilsStartTimings() void b3ChromeUtilsStartTimings()

View File

@@ -694,6 +694,24 @@ void CProfileManager::dumpAll()
CProfileManager::Release_Iterator(profileIterator); CProfileManager::Release_Iterator(profileIterator);
} }
void btEnterProfileZoneDefault(const char* name)
{
}
void btLeaveProfileZoneDefault()
{
}
#else
void btEnterProfileZoneDefault(const char* name)
{
}
void btLeaveProfileZoneDefault()
{
}
#endif //BT_NO_PROFILE
// clang-format off // clang-format off
#if defined(_WIN32) && (defined(__MINGW32__) || defined(__MINGW64__)) #if defined(_WIN32) && (defined(__MINGW32__) || defined(__MINGW64__))
#define BT_HAVE_TLS 1 #define BT_HAVE_TLS 1
@@ -743,22 +761,6 @@ unsigned int btQuickprofGetCurrentThreadIndex2()
#endif //BT_THREADSAFE #endif //BT_THREADSAFE
} }
void btEnterProfileZoneDefault(const char* name)
{
}
void btLeaveProfileZoneDefault()
{
}
#else
void btEnterProfileZoneDefault(const char* name)
{
}
void btLeaveProfileZoneDefault()
{
}
#endif //BT_NO_PROFILE
static btEnterProfileZoneFunc* bts_enterFunc = btEnterProfileZoneDefault; static btEnterProfileZoneFunc* bts_enterFunc = btEnterProfileZoneDefault;
static btLeaveProfileZoneFunc* bts_leaveFunc = btLeaveProfileZoneDefault; static btLeaveProfileZoneFunc* bts_leaveFunc = btLeaveProfileZoneDefault;

View File

@@ -61,18 +61,19 @@ btLeaveProfileZoneFunc* btGetCurrentLeaveProfileZoneFunc();
void btSetCustomEnterProfileZoneFunc(btEnterProfileZoneFunc* enterFunc); void btSetCustomEnterProfileZoneFunc(btEnterProfileZoneFunc* enterFunc);
void btSetCustomLeaveProfileZoneFunc(btLeaveProfileZoneFunc* leaveFunc); void btSetCustomLeaveProfileZoneFunc(btLeaveProfileZoneFunc* leaveFunc);
#ifndef BT_NO_PROFILE // FIX redefinition #ifndef BT_ENABLE_PROFILE
//To disable built-in profiling, please comment out next line #define BT_NO_PROFILE 1
//#define BT_NO_PROFILE 1
#endif //BT_NO_PROFILE #endif //BT_NO_PROFILE
const unsigned int BT_QUICKPROF_MAX_THREAD_COUNT = 64; const unsigned int BT_QUICKPROF_MAX_THREAD_COUNT = 64;
#ifndef BT_NO_PROFILE
//btQuickprofGetCurrentThreadIndex will return -1 if thread index cannot be determined, //btQuickprofGetCurrentThreadIndex will return -1 if thread index cannot be determined,
//otherwise returns thread index in range [0..maxThreads] //otherwise returns thread index in range [0..maxThreads]
unsigned int btQuickprofGetCurrentThreadIndex2(); unsigned int btQuickprofGetCurrentThreadIndex2();
#ifndef BT_NO_PROFILE
#include <stdio.h> //@todo remove this, backwards compatibility #include <stdio.h> //@todo remove this, backwards compatibility
#include "btAlignedAllocator.h" #include "btAlignedAllocator.h"