X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=timing.h;h=4db7847346356b41a8a12a9e226413f2e81abecb;hb=75962c819c16814e5c2340d99af1aa62e564dc20;hp=10bd1f7705bed69363a08c9a2b3d2dd99cf3c054;hpb=fe0f86cb70ff3ce31df98ed49e404c7e12e21b3d;p=mothur.git diff --git a/timing.h b/timing.h index 10bd1f7..4db7847 100644 --- a/timing.h +++ b/timing.h @@ -59,30 +59,29 @@ const unsigned AllocerCount = #undef A ; -#ifdef _MSC_VER +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) +typedef uint64_t TICKS; +__inline__ uint64_t GetClockTicks() +{ + uint32_t lo, hi; + /* We cannot use "=A", since this would use %rax on x86_64 */ + __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); + return (uint64_t)hi << 32 | lo; +} + +#else // ifdef _MSC_VER typedef unsigned __int64 TICKS; #pragma warning(disable:4035) inline TICKS GetClockTicks() - { +{ _asm - { + { _emit 0x0f _emit 0x31 - } - } - -#else // ifdef _MSC_VER - -typedef uint64_t TICKS; -__inline__ uint64_t GetClockTicks() - { - uint32_t lo, hi; - /* We cannot use "=A", since this would use %rax on x86_64 */ - __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); - return (uint64_t)hi << 32 | lo; } +} #endif // ifdef _MSC_VER