From bd9ffc16b58ba157b9a1360a296347e7c65ab202 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 23 Sep 2017 21:09:46 +0200 Subject: [PATCH] Hide GetTime() in Profiler. --- client/TracyProfiler.cpp | 6 ++++++ client/TracyProfiler.hpp | 7 +------ client/TracyScoped.hpp | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 9e7b426b..d94c11e4 100755 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -5,6 +5,7 @@ #endif #include +#include #include #include #include @@ -71,6 +72,11 @@ uint64_t Profiler::GetNewId() return s_instance->m_id.fetch_add( 1, std::memory_order_relaxed ); } +int64_t Profiler::GetTime() +{ + return std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); +} + uint64_t Profiler::ZoneBegin( QueueZoneBegin&& data ) { auto id = GetNewId(); diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 5431b0d9..4a43b703 100755 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -2,7 +2,6 @@ #define __TRACYPROFILER_HPP__ #include -#include #include #include @@ -14,11 +13,6 @@ namespace tracy class Socket; -static inline int64_t GetTime() -{ - return std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); -} - class Profiler { public: @@ -26,6 +20,7 @@ public: ~Profiler(); static uint64_t GetNewId(); + static int64_t GetTime(); static uint64_t ZoneBegin( QueueZoneBegin&& data ); static void ZoneEnd( uint64_t id, QueueZoneEnd&& data ); diff --git a/client/TracyScoped.hpp b/client/TracyScoped.hpp index c8cfb464..69774b66 100755 --- a/client/TracyScoped.hpp +++ b/client/TracyScoped.hpp @@ -13,13 +13,13 @@ class ScopedZone { public: ScopedZone( const char* file, const char* function, uint32_t line ) - : m_id( Profiler::ZoneBegin( QueueZoneBegin { GetTime(), (uint64_t)file, (uint64_t)function, line, GetThreadHandle() } ) ) + : m_id( Profiler::ZoneBegin( QueueZoneBegin { Profiler::GetTime(), (uint64_t)file, (uint64_t)function, line, GetThreadHandle() } ) ) { } ~ScopedZone() { - Profiler::ZoneEnd( m_id, QueueZoneEnd { GetTime() } ); + Profiler::ZoneEnd( m_id, QueueZoneEnd { Profiler::GetTime() } ); } private: