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

Ronald S. Bultje git at videolan.org
Sun Jul 8 22:38:55 CEST 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Sat Jul  7 13:30:11 2012 -0700| [07b287020c9ada750251344c05b52f541be4d533] | committer: Ronald S. Bultje

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=07b287020c9ada750251344c05b52f541be4d533
---

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

diff --git a/configure b/configure
index a08b3af..ec68648 100755
--- a/configure
+++ b/configure
@@ -1121,6 +1121,7 @@ HAVE_LIST="
     netinet_sctp_h
     poll_h
     posix_memalign
+    rdtsc
     round
     roundf
     sched_getaffinity
@@ -2642,6 +2643,8 @@ check_cc <<EOF && enable inline_asm
 void foo(void) { __asm__ volatile ("" ::); }
 EOF
 
+check_code cc intrin.h "__rdtsc()" && enable rdtsc
+
 _restrict=
 for restrict_keyword in restrict __restrict__ __restrict; do
     check_cc <<EOF && _restrict=$restrict_keyword && break
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 */



More information about the ffmpeg-cvslog mailing list