diff --git a/Sources/Engine/Base/Profiling.cpp b/Sources/Engine/Base/Profiling.cpp index d37d42e..bd23ba2 100644 --- a/Sources/Engine/Base/Profiling.cpp +++ b/Sources/Engine/Base/Profiling.cpp @@ -28,9 +28,15 @@ template class CStaticArray; static inline __int64 ReadTSC_profile(void) { #if (defined USE_PORTABLE_C) + #ifdef __arm__ + struct timespec tv; + clock_gettime(CLOCK_MONOTONIC, &tv); + return( (((__int64) tv.tv_sec) * 1000) + (((__int64) tv.tv_nsec) / 1000000) ); + #else struct timeval tv; gettimeofday(&tv, NULL); return( (((__int64) tv.tv_sec) * 1000) + (((__int64) tv.tv_usec) / 1000) ); + #endif #elif (defined __MSVC_INLINE__) __int64 mmRet; diff --git a/Sources/Engine/Base/Timer.cpp b/Sources/Engine/Base/Timer.cpp index 5f0fe0f..fb6dfe6 100644 --- a/Sources/Engine/Base/Timer.cpp +++ b/Sources/Engine/Base/Timer.cpp @@ -28,9 +28,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -//#if ( (USE_PORTABLE_C) || (PLATFORM_UNIX) ) -//#define USE_GETTIMEOFDAY 1 -//#endif +#if (USE_PORTABLE_C) +#define USE_GETTIMEOFDAY 1 +#endif #if USE_GETTIMEOFDAY #include @@ -40,10 +40,15 @@ with this program; if not, write to the Free Software Foundation, Inc., static inline __int64 ReadTSC(void) { #if USE_GETTIMEOFDAY +#ifdef PANDORA + struct timespec tp; + clock_gettime(CLOCK_MONOTONIC, &tp); + return( (((__int64) tp.tv_sec) * 1000000000LL) + ((__int64) tp.tv_nsec)); +#else struct timeval tv; gettimeofday(&tv, NULL); return( (((__int64) tv.tv_sec) * 1000000) + ((__int64) tv.tv_usec) ); - +#endif #elif (defined __MSVC_INLINE__) __int64 mmRet; __asm { @@ -315,7 +320,11 @@ CTimer::CTimer(BOOL bInterrupt /*=TRUE*/) #if USE_GETTIMEOFDAY // just use gettimeofday. + #ifdef PANDORA + tm_llCPUSpeedHZ = tm_llPerformanceCounterFrequency = 1000000000LL; + #else tm_llCPUSpeedHZ = tm_llPerformanceCounterFrequency = 1000000; + #endif #elif PLATFORM_WIN32 { // this part of code must be executed as precisely as possible