mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08: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"
|
#include "common/TracyQueue.hpp"
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
# include <TargetConditionals.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -52,7 +56,7 @@ namespace tracy
|
|||||||
std::atomic<uint8_t>& GetGpuCtxCounter() { return GetGpuCtxCounter_fpt(); }
|
std::atomic<uint8_t>& GetGpuCtxCounter() { return GetGpuCtxCounter_fpt(); }
|
||||||
GpuCtxWrapper& GetGpuCtx() { return GetGpuCtx_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())();
|
DLL_IMPORT int64_t(*get_GetTimeImpl())();
|
||||||
|
|
||||||
int64_t(*GetTimeImpl)() = get_GetTimeImpl();
|
int64_t(*GetTimeImpl)() = get_GetTimeImpl();
|
||||||
|
|||||||
@ -62,7 +62,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#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 <signal.h>
|
||||||
# include <setjmp.h>
|
# include <setjmp.h>
|
||||||
#endif
|
#endif
|
||||||
@ -143,7 +143,7 @@ struct ProducerWrapper
|
|||||||
#endif
|
#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 (*GetTimeImpl)();
|
||||||
|
|
||||||
int64_t GetTimeImplFallback()
|
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 std::atomic<uint8_t>&(*get_getgpuctxcounter())() { return GetGpuCtxCounter; }
|
||||||
DLL_EXPORT GpuCtxWrapper&(*get_getgpuctx())() { return GetGpuCtx; }
|
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; }
|
DLL_EXPORT int64_t(*get_GetTimeImpl())() { return GetTimeImpl; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1669,7 +1669,7 @@ bool Profiler::HandleServerQuery()
|
|||||||
void Profiler::CalibrateTimer()
|
void Profiler::CalibrateTimer()
|
||||||
{
|
{
|
||||||
#ifdef TRACY_HW_TIMER
|
#ifdef TRACY_HW_TIMER
|
||||||
# if __ARM_ARCH >= 6
|
# if __ARM_ARCH >= 6 && !defined TARGET_OS_IOS
|
||||||
if( GetTimeImpl == GetTimeImplFallback )
|
if( GetTimeImpl == GetTimeImplFallback )
|
||||||
{
|
{
|
||||||
m_timerMul = 1.;
|
m_timerMul = 1.;
|
||||||
|
|||||||
@ -20,6 +20,10 @@
|
|||||||
#if defined _WIN32 || defined __CYGWIN__
|
#if defined _WIN32 || defined __CYGWIN__
|
||||||
# include <intrin.h>
|
# include <intrin.h>
|
||||||
#endif
|
#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
|
#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
|
# define TRACY_HW_TIMER
|
||||||
@ -76,7 +80,7 @@ struct LuaZoneState
|
|||||||
|
|
||||||
using Magic = moodycamel::ConcurrentQueueDefaultTraits::index_t;
|
using Magic = moodycamel::ConcurrentQueueDefaultTraits::index_t;
|
||||||
|
|
||||||
#if __ARM_ARCH >= 6
|
#if __ARM_ARCH >= 6 && !defined TARGET_OS_IOS
|
||||||
extern int64_t (*GetTimeImpl)();
|
extern int64_t (*GetTimeImpl)();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -90,7 +94,10 @@ public:
|
|||||||
static tracy_force_inline int64_t GetTime( uint32_t& cpu )
|
static tracy_force_inline int64_t GetTime( uint32_t& cpu )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_HW_TIMER
|
#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;
|
cpu = 0xFFFFFFFF;
|
||||||
return GetTimeImpl();
|
return GetTimeImpl();
|
||||||
# elif defined _WIN32 || defined __CYGWIN__
|
# elif defined _WIN32 || defined __CYGWIN__
|
||||||
@ -110,7 +117,9 @@ public:
|
|||||||
static tracy_force_inline int64_t GetTime()
|
static tracy_force_inline int64_t GetTime()
|
||||||
{
|
{
|
||||||
#ifdef TRACY_HW_TIMER
|
#ifdef TRACY_HW_TIMER
|
||||||
# if __ARM_ARCH >= 6
|
# if TARGET_OS_IOS == 1
|
||||||
|
return mach_absolute_time();
|
||||||
|
# elif __ARM_ARCH >= 6
|
||||||
return GetTimeImpl();
|
return GetTimeImpl();
|
||||||
# elif defined _WIN32 || defined __CYGWIN__
|
# elif defined _WIN32 || defined __CYGWIN__
|
||||||
unsigned int dontcare;
|
unsigned int dontcare;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user