x86/timer: implement an intrinsic-based version for rdtsc (AV_READ_TIME).

pull/59/head
Ronald S. Bultje 13 years ago
parent 25b51b2c44
commit 07b287020c
  1. 3
      configure
  2. 8
      libavutil/x86/timer.h

3
configure vendored

@ -1121,6 +1121,7 @@ HAVE_LIST="
netinet_sctp_h netinet_sctp_h
poll_h poll_h
posix_memalign posix_memalign
rdtsc
round round
roundf roundf
sched_getaffinity sched_getaffinity
@ -2642,6 +2643,8 @@ check_cc <<EOF && enable inline_asm
void foo(void) { __asm__ volatile ("" ::); } void foo(void) { __asm__ volatile ("" ::); }
EOF EOF
check_code cc intrin.h "__rdtsc()" && enable rdtsc
_restrict= _restrict=
for restrict_keyword in restrict __restrict__ __restrict; do for restrict_keyword in restrict __restrict__ __restrict; do
check_cc <<EOF && _restrict=$restrict_keyword && break check_cc <<EOF && _restrict=$restrict_keyword && break

@ -23,6 +23,8 @@
#include <stdint.h> #include <stdint.h>
#if HAVE_INLINE_ASM
#define AV_READ_TIME read_time #define AV_READ_TIME read_time
static inline uint64_t read_time(void) static inline uint64_t read_time(void)
@ -32,4 +34,10 @@ static inline uint64_t read_time(void)
return ((uint64_t)d << 32) + a; return ((uint64_t)d << 32) + a;
} }
#elif HAVE_RDTSC
#define AV_READ_TIME __rdtsc
#endif /* HAVE_INLINE_ASM */
#endif /* AVUTIL_X86_TIMER_H */ #endif /* AVUTIL_X86_TIMER_H */

Loading…
Cancel
Save