* @file
* @brief OS abstraction from time measurement
* @author Sebastian Hack, Michael Beck, Matthias Braun
* @file
* @brief OS abstraction from time measurement
* @author Sebastian Hack, Michael Beck, Matthias Braun
-static inline timing_ticks_t __timing_ticks(void) { timing_ticks_t result; __asm__ __volatile__ ("rdtsc" : "=A" (result)); return result; }
-#else
-#if define _MSC_VER
-/* win32 implementation using rdtsc */
+static inline timing_ticks_t __timing_ticks(void)
+{
+ unsigned h;
+ unsigned l;
+ __asm__ volatile("rdtsc" : "=a" (l), "=d" (h));
+ return (timing_ticks_t)h << 32 | l;
+}
+
+#elif defined(_MSC_VER)
+#include <intrin.h>
+
#include <sys/time.h>
typedef struct timeval timing_ticks_t;
#define timing_ticks(t) (gettimeofday(&(t), NULL))
#include <sys/time.h>
typedef struct timeval timing_ticks_t;
#define timing_ticks(t) (gettimeofday(&(t), NULL))
/*
* This shamelessly stolen and modified from glibc's
* /usr/include/sys/time.h
*/
#define timing_ticks_cmp(a, b, CMP) \
/*
* This shamelessly stolen and modified from glibc's
* /usr/include/sys/time.h
*/
#define timing_ticks_cmp(a, b, CMP) \
((a).tv_usec CMP (b).tv_usec) : \
((a).tv_sec CMP (b).tv_sec))
#define timing_ticks_add(r, a) \
((a).tv_usec CMP (b).tv_usec) : \
((a).tv_sec CMP (b).tv_sec))
#define timing_ticks_add(r, a) \