mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Hide GetTime() in Profiler.
This commit is contained in:
parent
c0b1846a35
commit
bd9ffc16b5
@ -5,6 +5,7 @@
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <chrono>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <string.h>
|
||||
@ -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::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
|
||||
}
|
||||
|
||||
uint64_t Profiler::ZoneBegin( QueueZoneBegin&& data )
|
||||
{
|
||||
auto id = GetNewId();
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define __TRACYPROFILER_HPP__
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <stdint.h>
|
||||
#include <thread>
|
||||
|
||||
@ -14,11 +13,6 @@ namespace tracy
|
||||
|
||||
class Socket;
|
||||
|
||||
static inline int64_t GetTime()
|
||||
{
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>( 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 );
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user