mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Use mach_absolute_time() to get time on iOS.
This commit is contained in:
parent
e839a3153f
commit
44009b6fda
@ -20,6 +20,10 @@
|
||||
|
||||
#include "common/TracyQueue.hpp"
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include <TargetConditionals.h>
|
||||
#endif
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@ -52,7 +56,7 @@ namespace tracy
|
||||
std::atomic<uint8_t>& 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();
|
||||
|
@ -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 <signal.h>
|
||||
# include <setjmp.h>
|
||||
#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<uint32_t>&(*get_getlockcounter())() { return GetLockCount
|
||||
DLL_EXPORT std::atomic<uint8_t>&(*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.;
|
||||
|
@ -20,6 +20,10 @@
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
# include <intrin.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
# include <TargetConditionals.h>
|
||||
# include <mach/mach_time.h>
|
||||
#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;
|
||||
|
Loading…
Reference in New Issue
Block a user