double estimate_cpu_clock (void)
{
-#ifndef __arm__
- return estimate_tics_clock ();
-#else
+#if defined(__arm__) || defined(__aarch64__)
struct timeval tv1;
gettimeofday (&tv1, NULL);
- int instructions = 0;
+#ifdef __aarch64__ /* 64 bits */
+ int64_t instructions = 0;
+#else /* 32 bits */
+ int32_t instructions = 0;
+#endif
while (instructions < 10000000) {
#define INST0 "add %[i], %[i], #1\n\t"
#define INST1 INST0 INST0 INST0 INST0 INST0 INST0 INST0 INST0 \
((double)tv1.tv_sec + tv1.tv_usec * 1e-6);
return instructions / runtime;
+#else
+ return estimate_tics_clock ();
#endif /* __arm__ */
}