1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Record CPU id.

This commit is contained in:
Bartosz Taudul
2017-10-01 19:11:01 +02:00
parent f46781808c
commit a1abf1f015
4 changed files with 23 additions and 15 deletions
+5 -2
View File
@@ -32,12 +32,15 @@ public:
Profiler();
~Profiler();
static int64_t GetTime()
static int64_t GetTime( int8_t& cpu )
{
#if defined _MSC_VER || defined __CYGWIN__
unsigned int ui;
return int64_t( __rdtscp( &ui ) );
const auto t = int64_t( __rdtscp( &ui ) );
cpu = (int8_t)ui;
return t;
#else
cpu = -1;
return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
#endif
}