Index: lib/xray/xray_x86_64.cc =================================================================== --- lib/xray/xray_x86_64.cc +++ lib/xray/xray_x86_64.cc @@ -6,6 +6,8 @@ #if SANITIZER_FREEBSD || SANITIZER_NETBSD #include #include +#elif SANITIZER_MAC +#include #endif #include @@ -92,6 +94,18 @@ return 0; } +#elif SANITIZER_MAC +static mach_timebase_info_data_t TimebaseInfo; + +uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT { + if (TimebaseInfo.denom == 0) { + mach_timebase_info(&TimebaseInfo); + } + uint64_t currentTime = mach_absolute_time(); + currentTime *= TimebaseInfo.numer; + currentTime /= TimebaseInfo.denom; + return currentTime; +} #else uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT { /* Not supported */