27 #if defined(__i386__) || defined(__x86_64__)
45 #if defined(__x86_64__)
47 #define rdtscll(lo, hi) \
48 __asm__ __volatile__("rdtsc" : "=a" (lo), "=d" (hi))
60 #define rdtscll(val) \
61 __asm__ __volatile__("rdtsc" : "=A" (val))
68 return ret & 0xffffffff;
72 #elif defined(__powerpc64__)
75 #include <sys/platform/ppc.h>
79 return __ppc_get_timebase();
81 #elif defined(__FreeBSD__)
86 asm volatile(
"mfspr %0, 268" :
"=r"(tbr));
91 #elif defined(__powerpc__)
93 #define CPU_FTR_601 0x00000100
106 __asm__ __volatile__(
109 ".section __ftr_fixup,\"a\"\n"
115 :
"=r" (ret) :
"i" (CPU_FTR_601));
119 #elif defined(__ia64__)
127 __asm__ __volatile__ (
"mov %0=ar.itc" :
"=r"(ret));
131 #elif defined(__alpha__)
147 __asm__ __volatile__ (
"rpcc %0" :
"=r"(ret));
151 #elif defined(__s390__)
158 __asm__(
"stck 0(%0)" : :
"a" (&(cycles)) :
"memory",
"cc");
162 #elif defined(__hppa__)
165 #define mfctl(reg) ({ \
167 __asm__ __volatile__( \
168 "mfctl " #reg ",%0" : \
180 #elif defined(__mips__)
194 #define __read_32bit_c0_register(source, sel) \
197 __asm__ __volatile__( \
198 "mfc0\t%0, " #source "\n\t" \
201 __asm__ __volatile__( \
203 "mfc0\t%0, " #source ", " #sel "\n\t" \
210 #define read_c0_count() __read_32bit_c0_register($9, 0)
215 return read_c0_count();
219 #elif defined(__APPLE__)
221 #include <CoreAudio/HostTime.h>
226 UInt64 time = AudioGetCurrentHostTime();
227 return AudioConvertHostTimeToNanos(time);
235 #ifndef COMPILER_MSVC
237 #warning You are compiling libardour on a platform for which ardour/cycles.h needs work
240 #include <sys/time.h>
247 gettimeofday (&tv, NULL);
static cycles_t get_cycles(void)