[x264-devel] checkasm: add cycle counter read for aarch64

Janne Grunau git at videolan.org
Sat Dec 20 21:10:48 CET 2014


x264 | branch: master | Janne Grunau <janne-x264 at jannau.net> | Thu Nov  6 09:20:17 2014 +0100| [a6ec424939a4d3a59e4ec1e3999cb37e4314408e] | committer: Anton Mitrofanov

checkasm: add cycle counter read for aarch64

Needs kernel support since user space access to the cycle counter is not
allowed on all available AArch64 systems (Android 5 and iOS).

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=a6ec424939a4d3a59e4ec1e3999cb37e4314408e
---

 tools/checkasm.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/checkasm.c b/tools/checkasm.c
index a348aa1..c90c0cf 100644
--- a/tools/checkasm.c
+++ b/tools/checkasm.c
@@ -97,6 +97,10 @@ static inline uint32_t read_time(void)
     asm volatile( "mftb %0" : "=r"(a) :: "memory" );
 #elif ARCH_ARM     // ARMv7 only
     asm volatile( "mrc p15, 0, %0, c9, c13, 0" : "=r"(a) :: "memory" );
+#elif ARCH_AARCH64
+    uint64_t b = 0;
+    asm volatile( "mrs %0, pmccntr_el0" : "=r"(b) :: "memory" );
+    a = b;
 #endif
     return a;
 }
@@ -2764,7 +2768,7 @@ int main(int argc, char *argv[])
 
     if( argc > 1 && !strncmp( argv[1], "--bench", 7 ) )
     {
-#if !ARCH_X86 && !ARCH_X86_64 && !ARCH_PPC && !ARCH_ARM
+#if !ARCH_X86 && !ARCH_X86_64 && !ARCH_PPC && !ARCH_ARM && !ARCH_AARCH64
         fprintf( stderr, "no --bench for your cpu until you port rdtsc\n" );
         return 1;
 #endif



More information about the x264-devel mailing list