// return non-null if there is a status, nullptr otherwise virtual const struct SharedMemoryStatus* processServerStatus() { { if (btIsExampleBrowserMainThreadTerminated(m_data)) { PhysicsClientSharedMemory::disconnectSharedMemory(); } } { unsigned long int ms = m_clock.getTimeMilliseconds(); if (ms>2) { B3_PROFILE("m_clock.reset()"); btUpdateInProcessExampleBrowserMainThread(m_data); m_clock.reset(); } } { b3Clock::usleep(0); } const SharedMemoryStatus* stat = 0; { stat = PhysicsClientSharedMemory::processServerStatus(); } return stat; }
/*********************************************************************************************** * b3ProfileManager::Reset -- Reset the contents of the profiling system * * * * This resets everything except for the tree structure. All of the timing data is reset. * *=============================================================================================*/ void b3ProfileManager::Reset( void ) { b3s_profileClock.reset(); Root.Reset(); Root.Call(); FrameCounter = 0; b3Profile_Get_Ticks(&ResetTime); }
void enqueueCommand(const SharedMemoryCommand& orgCommand) { m_userCommandRequests.push_back(orgCommand); SharedMemoryCommand& cmd = m_userCommandRequests[m_userCommandRequests.size()-1]; cmd.m_sequenceNumber = m_sequenceNumberGenerator++; cmd.m_timeStamp = m_realtimeClock.getTimeMicroseconds(); b3Printf("User put command request %d on queue (queue length = %d)\n",cmd.m_type, m_userCommandRequests.size()); }
static void OutputTime(const char* name,b3Clock& c,unsigned count=0) { const unsigned long us=c.getTimeMicroseconds(); const unsigned long ms=(us+500)/1000; const b3Scalar sec=us/(b3Scalar)(1000*1000); if(count>0) printf("%s : %u us (%u ms), %.2f/s\r\n",name,us,ms,count/sec); else printf("%s : %u us (%u ms)\r\n",name,us,ms); }
InProcessPhysicsClientExistingExampleBrowser (struct GUIHelperInterface* guiHelper, bool useInProcessMemory, bool skipGraphicsUpdate) { m_sharedMem=0; CommonExampleOptions options(guiHelper); if (useInProcessMemory) { m_sharedMem = new InProcessMemory; options.m_sharedMem = m_sharedMem; } options.m_skipGraphicsUpdate = skipGraphicsUpdate; m_physicsServerExample = PhysicsServerCreateFuncBullet2(options); m_physicsServerExample ->initPhysics(); m_physicsServerExample ->resetCamera(); setSharedMemoryInterface(m_sharedMem); m_clock.reset(); m_prevTime = m_clock.getTimeMicroseconds(); }
// return non-null if there is a status, nullptr otherwise virtual const struct SharedMemoryStatus* processServerStatus() { m_physicsServerExample->updateGraphics(); unsigned long long int curTime = m_clock.getTimeMicroseconds(); unsigned long long int dtMicro = curTime - m_prevTime; m_prevTime = curTime; double dt = double(dtMicro)/1000000.; m_physicsServerExample->stepSimulation(dt); { b3Clock::usleep(0); } const SharedMemoryStatus* stat = 0; { stat = PhysicsClientSharedMemory::processServerStatus(); } return stat; }
__forceinline b3ProfileScope(b3Clock& clock,unsigned long& value) : m_clock(&clock),m_value(&value),m_base(clock.getTimeMicroseconds()) { }
inline void b3Profile_Get_Ticks(unsigned long int * ticks) { *ticks = b3s_profileClock.getTimeMicroseconds(); }