diff mbox

[3/3] linux-generic: use arch optimisations for time

Message ID 1427918573-30596-3-git-send-email-mike.holmes@linaro.org
State New
Headers show

Commit Message

Mike Holmes April 1, 2015, 8:02 p.m. UTC
Switch to using configure time optimizations from compile time

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 platform/linux-generic/Makefile.am |  3 +-
 platform/linux-generic/odp_time.c  | 64 --------------------------------------
 2 files changed, 2 insertions(+), 65 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index e5558ac..06d5998 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -167,4 +167,5 @@  __LIB__libodp_la_SOURCES = \
 			   odp_time.c \
 			   odp_timer.c \
 			   odp_version.c \
-			   odp_weak.c
+			   odp_weak.c \
+			   arch/@ARCH@/odp_time.c
diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c
index 31d6656..a08833d 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -12,70 +12,6 @@ 
 
 #define GIGA 1000000000
 
-#if defined __x86_64__ || defined __i386__
-
-uint64_t odp_time_cycles(void)
-{
-	union {
-		uint64_t tsc_64;
-		struct {
-			uint32_t lo_32;
-			uint32_t hi_32;
-		};
-	} tsc;
-
-	__asm__ __volatile__ ("rdtsc" :
-		     "=a" (tsc.lo_32),
-		     "=d" (tsc.hi_32) : : "memory");
-
-	return tsc.tsc_64;
-}
-
-
-#elif defined __OCTEON__
-
-uint64_t odp_time_cycles(void)
-{
-	#define CVMX_TMP_STR(x) CVMX_TMP_STR2(x)
-	#define CVMX_TMP_STR2(x) #x
-	uint64_t cycle;
-
-	__asm__ __volatile__ ("rdhwr %[rt],$" CVMX_TMP_STR(31) :
-			   [rt] "=d" (cycle) : : "memory");
-
-	return cycle;
-}
-
-#else
-
-#include <time.h>
-#include <stdlib.h>
-#include <odp_debug_internal.h>
-
-uint64_t odp_time_cycles(void)
-{
-	struct timespec time;
-	uint64_t sec, ns, hz, cycles;
-	int ret;
-
-	ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
-
-	if (ret != 0) {
-		ODP_ABORT("clock_gettime failed\n");
-	}
-
-	hz  = odp_sys_cpu_hz();
-	sec = (uint64_t) time.tv_sec;
-	ns  = (uint64_t) time.tv_nsec;
-
-	cycles  = sec * hz;
-	cycles += (ns * hz) / GIGA;
-
-	return cycles;
-}
-
-#endif
-
 uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
 {
 	if (odp_likely(t2 > t1))