24 #ifndef PXR_BASE_ARCH_TIMING_H
25 #define PXR_BASE_ARCH_TIMING_H
32 #include "pxr/base/arch/api.h"
33 #include "pxr/base/arch/defines.h"
39 #if defined(ARCH_OS_LINUX) && defined(ARCH_CPU_INTEL)
40 #include <x86intrin.h>
41 #elif defined(ARCH_OS_DARWIN)
42 #include <mach/mach_time.h>
43 #elif defined(ARCH_OS_WINDOWS)
47 PXR_NAMESPACE_OPEN_SCOPE
54 #define ARCH_CLK_TCK 100
66 #if defined(ARCH_OS_DARWIN)
68 return mach_absolute_time();
69 #elif defined(ARCH_CPU_INTEL)
72 #elif defined (ARCH_CPU_ARM)
74 __asm __volatile(
"mrs %0, CNTVCT_EL0" :
"=&r" (result));
77 #error Unknown architecture.
114 PXR_NAMESPACE_CLOSE_SCOPE
116 #endif // PXR_BASE_ARCH_TIMING_H
ARCH_API double ArchTicksToSeconds(uint64_t nTicks)
Convert a duration measured in "ticks", as returned by ArchGetTickTime(), to seconds.
uint64_t ArchGetTickTime()
Return the current time in system-dependent units.
ARCH_API double ArchGetNanosecondsPerTick()
Get nanoseconds per tick.
ARCH_API int64_t ArchTicksToNanoseconds(uint64_t nTicks)
Convert a duration measured in "ticks", as returned by ArchGetTickTime(), to nanoseconds.
ARCH_API uint64_t ArchSecondsToTicks(double seconds)
Convert a duration in seconds to "ticks", as returned by ArchGetTickTime().