diff --git a/TracyClientDLL.cpp b/TracyClientDLL.cpp index de6ad3b0..ef51c608 100644 --- a/TracyClientDLL.cpp +++ b/TracyClientDLL.cpp @@ -20,6 +20,10 @@ #include "common/TracyQueue.hpp" +#ifdef __APPLE__ +# include +#endif + namespace tracy { #ifdef _WIN32 @@ -52,7 +56,7 @@ namespace tracy std::atomic& GetGpuCtxCounter() { return GetGpuCtxCounter_fpt(); } GpuCtxWrapper& GetGpuCtx() { return GetGpuCtx_fpt(); } -#if defined TRACY_HW_TIMER && __ARM_ARCH >= 6 +#if defined TRACY_HW_TIMER && __ARM_ARCH >= 6 && !defined TARGET_OS_IOS DLL_IMPORT int64_t(*get_GetTimeImpl())(); int64_t(*GetTimeImpl)() = get_GetTimeImpl(); diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index f6dd3105..ce7cfcef 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -62,7 +62,7 @@ # endif #endif -#if defined TRACY_HW_TIMER && __ARM_ARCH >= 6 +#if defined TRACY_HW_TIMER && __ARM_ARCH >= 6 && !defined TARGET_OS_IOS # include # include #endif @@ -143,7 +143,7 @@ struct ProducerWrapper #endif -#if defined TRACY_HW_TIMER && __ARM_ARCH >= 6 +#if defined TRACY_HW_TIMER && __ARM_ARCH >= 6 && !defined TARGET_OS_IOS int64_t (*GetTimeImpl)(); int64_t GetTimeImplFallback() @@ -897,7 +897,7 @@ DLL_EXPORT std::atomic&(*get_getlockcounter())() { return GetLockCount DLL_EXPORT std::atomic&(*get_getgpuctxcounter())() { return GetGpuCtxCounter; } DLL_EXPORT GpuCtxWrapper&(*get_getgpuctx())() { return GetGpuCtx; } -#if defined TRACY_HW_TIMER && __ARM_ARCH >= 6 +#if defined TRACY_HW_TIMER && __ARM_ARCH >= 6 && !defined TARGET_OS_IOS DLL_EXPORT int64_t(*get_GetTimeImpl())() { return GetTimeImpl; } #endif @@ -1669,7 +1669,7 @@ bool Profiler::HandleServerQuery() void Profiler::CalibrateTimer() { #ifdef TRACY_HW_TIMER -# if __ARM_ARCH >= 6 +# if __ARM_ARCH >= 6 && !defined TARGET_OS_IOS if( GetTimeImpl == GetTimeImplFallback ) { m_timerMul = 1.; diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 1d3b0a73..67999272 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -20,6 +20,10 @@ #if defined _WIN32 || defined __CYGWIN__ # include #endif +#ifdef __APPLE__ +# include +# include +#endif #if defined _WIN32 || defined __CYGWIN__ || ( ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 ) && !defined __ANDROID__ ) || __ARM_ARCH >= 6 # define TRACY_HW_TIMER @@ -76,7 +80,7 @@ struct LuaZoneState using Magic = moodycamel::ConcurrentQueueDefaultTraits::index_t; -#if __ARM_ARCH >= 6 +#if __ARM_ARCH >= 6 && !defined TARGET_OS_IOS extern int64_t (*GetTimeImpl)(); #endif @@ -90,7 +94,10 @@ public: static tracy_force_inline int64_t GetTime( uint32_t& cpu ) { #ifdef TRACY_HW_TIMER -# if __ARM_ARCH >= 6 +# if TARGET_OS_IOS == 1 + cpu = 0xFFFFFFFF; + return mach_absolute_time(); +# elif __ARM_ARCH >= 6 cpu = 0xFFFFFFFF; return GetTimeImpl(); # elif defined _WIN32 || defined __CYGWIN__ @@ -110,7 +117,9 @@ public: static tracy_force_inline int64_t GetTime() { #ifdef TRACY_HW_TIMER -# if __ARM_ARCH >= 6 +# if TARGET_OS_IOS == 1 + return mach_absolute_time(); +# elif __ARM_ARCH >= 6 return GetTimeImpl(); # elif defined _WIN32 || defined __CYGWIN__ unsigned int dontcare;