mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Use rdtscp when there's no intrinsic.
This commit is contained in:
parent
9cde85646a
commit
7b1135239c
@ -46,6 +46,12 @@ public:
|
||||
const auto t = int64_t( __rdtscp( &ui ) );
|
||||
cpu = (int8_t)ui;
|
||||
return t;
|
||||
#elif defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64
|
||||
uint64_t eax, edx;
|
||||
unsigned int ui;
|
||||
asm volatile ( "rdtscp" : "=a" (eax), "=d" (edx), "=c" (ui) :: );
|
||||
cpu = (int8_t)ui;
|
||||
return ( edx << 32 ) + eax;
|
||||
#else
|
||||
cpu = -1;
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
|
||||
|
Loading…
Reference in New Issue
Block a user