1
0
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:
Bartosz Taudul
2017-09-26 00:42:09 +02:00
parent 11a790a18f
commit e5ad7d9ac4
2 changed files with 14 additions and 15 deletions
-14
View File
@@ -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();