File perftest-aarch64.patch of Package perftest

From a589682e90aefaa2c9ab03a3e1426b0f7c1a5eb2 Mon Sep 17 00:00:00 2001
From: Gil Rockah <gilr@mellanox.com>
Date: Mon, 26 May 2014 19:10:33 +0300
Subject: [PATCH 1/1] Add support for aarch64.
 added config.guess and config.sub scripts to source code.

Change-Id: I5ccc5f2a28e40e53fcf13ec1f6cd3c68978347e1
Signed-off-by: Gil Rockah <gilr@mellanox.com>
---
 Makefile.am         |    1 +
 config/config.guess | 1420 ++++++++++++++++++++++++++++++++++++++++
 config/config.sub   | 1794 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/get_clock.c     |    7 +-
 src/get_clock.h     |   11 +
 5 files changed, 3232 insertions(+), 1 deletions(-)
 create mode 100644 config/config.guess
 create mode 100644 config/config.sub

--- a/src/get_clock.c
+++ b/src/get_clock.c
@@ -191,7 +191,12 @@ double get_cpu_mhz(int no_cpu_freq_fail)
 	double sample, proc, delta;
 	sample = sample_get_cpu_mhz();
 	proc = proc_get_cpu_mhz(no_cpu_freq_fail);
-
+	#ifdef __aarch64__
+	if (proc < 1) //no cpu_freq info in /proc/cpuinfo
+	{
+		proc = sample;
+	}
+	#endif
 	if (!proc || !sample)
 		return 0;
 
--- a/src/get_clock.h
+++ b/src/get_clock.h
@@ -78,6 +78,17 @@ static inline cycles_t get_cycles(void)
        asm volatile("stck %0" : "=Q" (clk) : : "cc");
        return clk >> 2;
 }
+#elif defined(__aarch64__)
+
+typedef unsigned long cycles_t;
+static inline cycles_t get_cycles()
+{
+        cycles_t cval;
+        asm volatile("isb" : : : "memory");
+        asm volatile("mrs %0, cntvct_el0" : "=r" (cval));
+        return cval;
+}
+
 #else
 #warning get_cycles not implemented for this architecture: attempt asm/timex.h
 #include <asm/timex.h>
-- 
1.7.1