Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2016-01-17 23:35:32 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-01-26 00:14:46 +0300
commitb64d5809e7e3b832e2a011869db68e70b4b4e6fc (patch)
treeaa4f6714da9f546eeee7dffed9236f9c8309524b /extern/bullet2/src/LinearMath/btQuickprof.cpp
parent3c72e302e1eb25de43dd9d077f0c730cc02b5674 (diff)
Upgrade Bullet to version 2.83.
I tried to carefully preserve all patches since the last upgrade. Improves T47195, cloth collision detection bug. Differential Revision: https://developer.blender.org/D1739
Diffstat (limited to 'extern/bullet2/src/LinearMath/btQuickprof.cpp')
-rw-r--r--extern/bullet2/src/LinearMath/btQuickprof.cpp90
1 files changed, 51 insertions, 39 deletions
diff --git a/extern/bullet2/src/LinearMath/btQuickprof.cpp b/extern/bullet2/src/LinearMath/btQuickprof.cpp
index 544aee89d02..d88d965a4cc 100644
--- a/extern/bullet2/src/LinearMath/btQuickprof.cpp
+++ b/extern/bullet2/src/LinearMath/btQuickprof.cpp
@@ -10,7 +10,7 @@
**
***************************************************************************************************/
-// Credits: The Clock class was inspired by the Timer classes in
+// Credits: The Clock class was inspired by the Timer classes in
// Ogre (www.ogre3d.org).
#include "btQuickprof.h"
@@ -27,8 +27,8 @@ static btClock gProfileClock;
#include <stdio.h>
#endif
-#if defined (SUNOS) || defined (__SUNOS__)
-#include <stdio.h>
+#if defined (SUNOS) || defined (__SUNOS__)
+#include <stdio.h>
#endif
#if defined(WIN32) || defined(_WIN32)
@@ -37,12 +37,17 @@ static btClock gProfileClock;
#define WIN32_LEAN_AND_MEAN
#define NOWINRES
#define NOMCX
-#define NOIME
+#define NOIME
#ifdef _XBOX
#include <Xtl.h>
#else //_XBOX
#include <windows.h>
+
+#if WINVER <0x0602
+#define GetTickCount64 GetTickCount
+#endif
+
#endif //_XBOX
#include <time.h>
@@ -59,7 +64,7 @@ struct btClockData
#ifdef BT_USE_WINDOWS_TIMERS
LARGE_INTEGER mClockFrequency;
- DWORD mStartTick;
+ LONGLONG mStartTick;
LONGLONG mPrevElapsedTime;
LARGE_INTEGER mStartTime;
#else
@@ -105,7 +110,7 @@ void btClock::reset()
{
#ifdef BT_USE_WINDOWS_TIMERS
QueryPerformanceCounter(&m_data->mStartTime);
- m_data->mStartTick = GetTickCount();
+ m_data->mStartTick = GetTickCount64();
m_data->mPrevElapsedTime = 0;
#else
#ifdef __CELLOS_LV2__
@@ -121,34 +126,34 @@ void btClock::reset()
#endif
}
-/// Returns the time in ms since the last call to reset or since
+/// Returns the time in ms since the last call to reset or since
/// the btClock was created.
unsigned long int btClock::getTimeMilliseconds()
{
#ifdef BT_USE_WINDOWS_TIMERS
LARGE_INTEGER currentTime;
QueryPerformanceCounter(&currentTime);
- LONGLONG elapsedTime = currentTime.QuadPart -
+ LONGLONG elapsedTime = currentTime.QuadPart -
m_data->mStartTime.QuadPart;
// Compute the number of millisecond ticks elapsed.
- unsigned long msecTicks = (unsigned long)(1000 * elapsedTime /
+ unsigned long msecTicks = (unsigned long)(1000 * elapsedTime /
m_data->mClockFrequency.QuadPart);
- // Check for unexpected leaps in the Win32 performance counter.
- // (This is caused by unexpected data across the PCI to ISA
+ // Check for unexpected leaps in the Win32 performance counter.
+ // (This is caused by unexpected data across the PCI to ISA
// bridge, aka south bridge. See Microsoft KB274323.)
- unsigned long elapsedTicks = GetTickCount() - m_data->mStartTick;
+ unsigned long elapsedTicks = (unsigned long)(GetTickCount64() - m_data->mStartTick);
signed long msecOff = (signed long)(msecTicks - elapsedTicks);
if (msecOff < -100 || msecOff > 100)
{
// Adjust the starting time forwards.
- LONGLONG msecAdjustment = mymin(msecOff *
- m_data->mClockFrequency.QuadPart / 1000, elapsedTime -
+ LONGLONG msecAdjustment = mymin(msecOff *
+ m_data->mClockFrequency.QuadPart / 1000, elapsedTime -
m_data->mPrevElapsedTime);
m_data->mStartTime.QuadPart += msecAdjustment;
elapsedTime -= msecAdjustment;
// Recompute the number of millisecond ticks elapsed.
- msecTicks = (unsigned long)(1000 * elapsedTime /
+ msecTicks = (unsigned long)(1000 * elapsedTime /
m_data->mClockFrequency.QuadPart);
}
@@ -171,36 +176,36 @@ unsigned long int btClock::getTimeMilliseconds()
struct timeval currentTime;
gettimeofday(&currentTime, 0);
- return (currentTime.tv_sec - m_data->mStartTime.tv_sec) * 1000 +
+ return (currentTime.tv_sec - m_data->mStartTime.tv_sec) * 1000 +
(currentTime.tv_usec - m_data->mStartTime.tv_usec) / 1000;
#endif //__CELLOS_LV2__
#endif
}
- /// Returns the time in us since the last call to reset or since
+ /// Returns the time in us since the last call to reset or since
/// the Clock was created.
unsigned long int btClock::getTimeMicroseconds()
{
#ifdef BT_USE_WINDOWS_TIMERS
LARGE_INTEGER currentTime;
QueryPerformanceCounter(&currentTime);
- LONGLONG elapsedTime = currentTime.QuadPart -
+ LONGLONG elapsedTime = currentTime.QuadPart -
m_data->mStartTime.QuadPart;
// Compute the number of millisecond ticks elapsed.
- unsigned long msecTicks = (unsigned long)(1000 * elapsedTime /
+ unsigned long msecTicks = (unsigned long)(1000 * elapsedTime /
m_data->mClockFrequency.QuadPart);
- // Check for unexpected leaps in the Win32 performance counter.
- // (This is caused by unexpected data across the PCI to ISA
+ // Check for unexpected leaps in the Win32 performance counter.
+ // (This is caused by unexpected data across the PCI to ISA
// bridge, aka south bridge. See Microsoft KB274323.)
- unsigned long elapsedTicks = GetTickCount() - m_data->mStartTick;
+ unsigned long elapsedTicks = (unsigned long)(GetTickCount64() - m_data->mStartTick);
signed long msecOff = (signed long)(msecTicks - elapsedTicks);
if (msecOff < -100 || msecOff > 100)
{
// Adjust the starting time forwards.
- LONGLONG msecAdjustment = mymin(msecOff *
- m_data->mClockFrequency.QuadPart / 1000, elapsedTime -
+ LONGLONG msecAdjustment = mymin(msecOff *
+ m_data->mClockFrequency.QuadPart / 1000, elapsedTime -
m_data->mPrevElapsedTime);
m_data->mStartTime.QuadPart += msecAdjustment;
elapsedTime -= msecAdjustment;
@@ -210,7 +215,7 @@ unsigned long int btClock::getTimeMicroseconds()
m_data->mPrevElapsedTime = elapsedTime;
// Convert to microseconds.
- unsigned long usecTicks = (unsigned long)(1000000 * elapsedTime /
+ unsigned long usecTicks = (unsigned long)(1000000 * elapsedTime /
m_data->mClockFrequency.QuadPart);
return usecTicks;
@@ -229,14 +234,22 @@ unsigned long int btClock::getTimeMicroseconds()
struct timeval currentTime;
gettimeofday(&currentTime, 0);
- return (currentTime.tv_sec - m_data->mStartTime.tv_sec) * 1000000 +
+ return (currentTime.tv_sec - m_data->mStartTime.tv_sec) * 1000000 +
(currentTime.tv_usec - m_data->mStartTime.tv_usec);
#endif//__CELLOS_LV2__
-#endif
+#endif
}
+/// Returns the time in s since the last call to reset or since
+/// the Clock was created.
+btScalar btClock::getTimeSeconds()
+{
+ static const btScalar microseconds_to_seconds = btScalar(0.000001);
+ return btScalar(getTimeMicroseconds()) * microseconds_to_seconds;
+}
+
inline void Profile_Get_Ticks(unsigned long int * ticks)
@@ -293,8 +306,7 @@ void CProfileNode::CleanupMemory()
CProfileNode::~CProfileNode( void )
{
- delete ( Child);
- delete ( Sibling);
+ CleanupMemory();
}
@@ -318,7 +330,7 @@ CProfileNode * CProfileNode::Get_Sub_Node( const char * name )
}
// We didn't find it, so add it
-
+
CProfileNode * node = new CProfileNode( name, this );
node->Sibling = Child;
Child = node;
@@ -330,7 +342,7 @@ void CProfileNode::Reset( void )
{
TotalCalls = 0;
TotalTime = 0.0f;
-
+
if ( Child ) {
Child->Reset();
@@ -352,7 +364,7 @@ void CProfileNode::Call( void )
bool CProfileNode::Return( void )
{
- if ( --RecursionCounter == 0 && TotalCalls != 0 ) {
+ if ( --RecursionCounter == 0 && TotalCalls != 0 ) {
unsigned long int time;
Profile_Get_Ticks(&time);
time-=StartTime;
@@ -445,8 +457,8 @@ void CProfileManager::Start_Profile( const char * name )
{
if (name != CurrentNode->Get_Name()) {
CurrentNode = CurrentNode->Get_Sub_Node( name );
- }
-
+ }
+
CurrentNode->Call();
}
@@ -470,7 +482,7 @@ void CProfileManager::Stop_Profile( void )
* This resets everything except for the tree structure. All of the timing data is reset. *
*=============================================================================================*/
void CProfileManager::Reset( void )
-{
+{
gProfileClock.reset();
Root.Reset();
Root.Call();
@@ -516,9 +528,9 @@ void CProfileManager::dumpRecursive(CProfileIterator* profileIterator, int spaci
printf("Profiling: %s (total running time: %.3f ms) ---\n", profileIterator->Get_Current_Parent_Name(), parent_time );
float totalTime = 0.f;
-
+
int numChildren = 0;
-
+
for (i = 0; !profileIterator->Is_Done(); i++,profileIterator->Next())
{
numChildren++;
@@ -535,11 +547,11 @@ void CProfileManager::dumpRecursive(CProfileIterator* profileIterator, int spaci
if (parent_time < accumulated_time)
{
- printf("what's wrong\n");
+ //printf("what's wrong\n");
}
for (i=0;i<spacing;i++) printf(".");
printf("%s (%.3f %%) :: %.3f ms\n", "Unaccounted:",parent_time > SIMD_EPSILON ? ((parent_time - accumulated_time) / parent_time) * 100 : 0.f, parent_time - accumulated_time);
-
+
for (i=0;i<numChildren;i++)
{
profileIterator->Enter_Child(i);