mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
GetTime() call can be now inlined.
No dependencies on either windows.h, or static instance of Profiler.
This commit is contained in:
@@ -4,10 +4,6 @@
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if defined _MSC_VER || defined __CYGWIN__
|
||||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
#include <atomic>
|
||||
#include <assert.h>
|
||||
#include <chrono>
|
||||
@@ -82,16 +78,6 @@ uint64_t Profiler::GetNewId()
|
||||
return s_instance->m_id.fetch_add( 1, std::memory_order_relaxed );
|
||||
}
|
||||
|
||||
int64_t Profiler::GetTime()
|
||||
{
|
||||
#if defined _MSC_VER || defined __CYGWIN__
|
||||
unsigned int ui;
|
||||
return int64_t( __rdtscp( &ui ) );
|
||||
#else
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64_t Profiler::ZoneBegin( QueueZoneBegin&& data )
|
||||
{
|
||||
auto id = GetNewId();
|
||||
|
||||
Reference in New Issue
Block a user