From 7b1135239c575b9d191a1b011d2b94ca80da3b74 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 3 Oct 2017 15:27:07 +0200 Subject: [PATCH] Use rdtscp when there's no intrinsic. --- client/TracyProfiler.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 33912cc8..fa8769d0 100755 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -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::high_resolution_clock::now().time_since_epoch() ).count();