src/vm/cycles-stats.h: Switched from asm_get_cycle_count to md_get_cycle_count.
[cacao.git] / src / vm / jit / i386 / md.h
index 9bfa133732d07630da8dfad573d31a59e366fbeb..0756bb26a1db78dbc07a19eb7538b34116e9b38e 100644 (file)
@@ -139,6 +139,23 @@ inline static void md_dcacheflush(void *addr, int nbytes)
        __asm__ __volatile__ ("" : : : "memory");
 }
 
+
+/* md_get_cycle_count **********************************************************
+
+   Get the current time-stamp counter from the CPU.
+
+*******************************************************************************/
+
+inline static uint64_t md_get_cycle_count()
+{
+       uint64_t cycles;
+
+       // Get current cycles count from the CPU.
+       __asm__ __volatile__ ("rdtsc" : "=A" (cycles));
+
+       return cycles;
+}
+
 #endif /* _VM_JIT_I386_MD_H */