From 834edf0dc29836a97bb7bbaf69712980bee408ab Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 26 Sep 2017 19:09:52 +0100 Subject: [PATCH] Add a microsecond timer from the start of the process --- renderdoc/common/timing.h | 4 ++++ renderdoc/core/core.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/renderdoc/common/timing.h b/renderdoc/common/timing.h index 279599469..9935e8833 100644 --- a/renderdoc/common/timing.h +++ b/renderdoc/common/timing.h @@ -41,6 +41,10 @@ public: { return double(Timing::GetTick() - m_Start) / m_CounterFrequency; } + double GetMicroseconds() const + { + return (double(Timing::GetTick() - m_Start) * 1000.0) / m_CounterFrequency; + } void Restart() { m_Start = Timing::GetTick(); } private: diff --git a/renderdoc/core/core.h b/renderdoc/core/core.h index 756f03caf..6c58d91d3 100644 --- a/renderdoc/core/core.h +++ b/renderdoc/core/core.h @@ -205,6 +205,7 @@ public: void Initialise(); void Shutdown(); + uint64_t GetMicrosecondTimestamp() { return uint64_t(m_Timer.GetMicroseconds()); } const GlobalEnvironment GetGlobalEnvironment() { return m_GlobalEnv; } void ProcessGlobalEnvironment(GlobalEnvironment env, const std::vector &args); @@ -450,6 +451,8 @@ private: Threading::CriticalSection m_SingleClientLock; string m_SingleClientName; + PerformanceTimer m_Timer; + static void TargetControlServerThread(Network::Socket *sock); static void TargetControlClientThread(Network::Socket *client);