diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 41a451b8..cc9fc9ef 100755 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -19,6 +19,7 @@ #include "../common/TracySocket.hpp" #include "../common/TracySystem.hpp" #include "concurrentqueue.h" +#include "TracyScoped.hpp" #include "TracyProfiler.hpp" #include "TracyThread.hpp" @@ -58,6 +59,7 @@ Profiler::Profiler() s_instance = this; CalibrateTimer(); + CalibrateDelay(); m_timeBegin = GetTime(); m_thread = std::thread( [this] { Worker(); } ); @@ -280,4 +282,50 @@ void Profiler::CalibrateTimer() #endif } +class FakeZone +{ +public: + FakeZone( const char* file, const char* function, uint32_t line ) {} + ~FakeZone() {} + +private: + uint64_t m_id; +}; + +void Profiler::CalibrateDelay() +{ + enum { Iterations = 50000 }; + enum { Events = Iterations * 2 }; // start + end + static_assert( Events * 2 < QueuePrealloc, "Delay calibration loop will allocate memory in queue" ); + for( int i=0; i 0 ); + left -= sz; + } +} + } diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 14d8d011..e7a1adc0 100755 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -37,8 +37,10 @@ private: bool HandleServerQuery(); void CalibrateTimer(); + void CalibrateDelay(); double m_timerMul; + uint64_t m_delay; int64_t m_timeBegin; uint64_t m_mainThread; std::thread m_thread;