From: "Ronald S. Bultje" <[email protected]>

---
 configure             |    2 ++
 libavutil/x86/timer.h |    8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/configure b/configure
index 07dbb46..61b773f 100755
--- a/configure
+++ b/configure
@@ -1125,6 +1125,7 @@ HAVE_LIST="
     netinet_sctp_h
     poll_h
     posix_memalign
+    rdtsc
     round
     roundf
     sched_getaffinity
@@ -2650,6 +2651,7 @@ EOF
 check_code cc mmintrin.h "_mm_empty()" && enable mm_empty
 check_code cc immintrin.h "xgetbv(0)" && enable xgetbv
 check_code cc intrin.h "int info[4]; _cpuid(info, 0)" && enable cpuid
+check_code cc intrin.h "__rdtsc()" && enable rdtsc
 
 check_code cc "" "__asm { __asm xor eax, eax }" && enable msvc_inline_asm
 
diff --git a/libavutil/x86/timer.h b/libavutil/x86/timer.h
index 7f51816..35e614d 100644
--- a/libavutil/x86/timer.h
+++ b/libavutil/x86/timer.h
@@ -23,6 +23,8 @@
 
 #include <stdint.h>
 
+#if HAVE_INLINE_ASM
+
 #define AV_READ_TIME read_time
 
 static inline uint64_t read_time(void)
@@ -32,4 +34,10 @@ static inline uint64_t read_time(void)
     return ((uint64_t)d << 32) + a;
 }
 
+#elif HAVE_RDTSC
+
+#define AV_READ_TIME __rdtsc
+
+#endif /* HAVE_INLINE_ASM */
+
 #endif /* AVUTIL_X86_TIMER_H */
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to