These arch depedent files are not limited to cpu_cycle
calls implementation only.

Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>
---
 platform/linux-generic/Makefile.am                 |  8 ++--
 platform/linux-generic/arch/linux/odp_cpu_arch.c   | 48 ++++++++++++++++++++++
 platform/linux-generic/arch/linux/odp_cpu_cycles.c | 48 ----------------------
 platform/linux-generic/arch/mips64/odp_cpu_arch.c  | 31 ++++++++++++++
 .../linux-generic/arch/mips64/odp_cpu_cycles.c     | 31 --------------
 platform/linux-generic/arch/x86/odp_cpu_arch.c     | 33 +++++++++++++++
 platform/linux-generic/arch/x86/odp_cpu_cycles.c   | 33 ---------------
 7 files changed, 116 insertions(+), 116 deletions(-)
 create mode 100644 platform/linux-generic/arch/linux/odp_cpu_arch.c
 delete mode 100644 platform/linux-generic/arch/linux/odp_cpu_cycles.c
 create mode 100644 platform/linux-generic/arch/mips64/odp_cpu_arch.c
 delete mode 100644 platform/linux-generic/arch/mips64/odp_cpu_cycles.c
 create mode 100644 platform/linux-generic/arch/x86/odp_cpu_arch.c
 delete mode 100644 platform/linux-generic/arch/x86/odp_cpu_cycles.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 75ca703..56c244e 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -158,12 +158,12 @@ __LIB__libodp_la_SOURCES = \
                           odp_traffic_mngr.c \
                           odp_version.c \
                           odp_weak.c \
-                          arch/@ARCH@/odp_cpu_cycles.c
+                          arch/@ARCH@/odp_cpu_arch.c
 
 EXTRA_DIST = \
-            arch/linux/odp_cpu_cycles.c \
-            arch/mips64/odp_cpu_cycles.c \
-            arch/x86/odp_cpu_cycles.c
+            arch/linux/odp_cpu_arch.c \
+            arch/mips64/odp_cpu_arch.c \
+            arch/x86/odp_cpu_arch.c
 
 if HAVE_PCAP
 __LIB__libodp_la_SOURCES += pktio/pcap.c
diff --git a/platform/linux-generic/arch/linux/odp_cpu_arch.c 
b/platform/linux-generic/arch/linux/odp_cpu_arch.c
new file mode 100644
index 0000000..0a41727
--- /dev/null
+++ b/platform/linux-generic/arch/linux/odp_cpu_arch.c
@@ -0,0 +1,48 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#define _POSIX_C_SOURCE 199309L
+
+#include <stdlib.h>
+#include <time.h>
+
+#include <odp/cpu.h>
+#include <odp/hints.h>
+#include <odp/system_info.h>
+#include <odp_debug_internal.h>
+
+#define GIGA 1000000000
+
+uint64_t odp_cpu_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_cpu_hz_max();
+       sec = (uint64_t)time.tv_sec;
+       ns  = (uint64_t)time.tv_nsec;
+
+       cycles  = sec * hz;
+       cycles += (ns * hz) / GIGA;
+
+       return cycles;
+}
+
+uint64_t odp_cpu_cycles_max(void)
+{
+       return UINT64_MAX;
+}
+
+uint64_t odp_cpu_cycles_resolution(void)
+{
+       return 1;
+}
diff --git a/platform/linux-generic/arch/linux/odp_cpu_cycles.c 
b/platform/linux-generic/arch/linux/odp_cpu_cycles.c
deleted file mode 100644
index 0a41727..0000000
--- a/platform/linux-generic/arch/linux/odp_cpu_cycles.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-#define _POSIX_C_SOURCE 199309L
-
-#include <stdlib.h>
-#include <time.h>
-
-#include <odp/cpu.h>
-#include <odp/hints.h>
-#include <odp/system_info.h>
-#include <odp_debug_internal.h>
-
-#define GIGA 1000000000
-
-uint64_t odp_cpu_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_cpu_hz_max();
-       sec = (uint64_t)time.tv_sec;
-       ns  = (uint64_t)time.tv_nsec;
-
-       cycles  = sec * hz;
-       cycles += (ns * hz) / GIGA;
-
-       return cycles;
-}
-
-uint64_t odp_cpu_cycles_max(void)
-{
-       return UINT64_MAX;
-}
-
-uint64_t odp_cpu_cycles_resolution(void)
-{
-       return 1;
-}
diff --git a/platform/linux-generic/arch/mips64/odp_cpu_arch.c 
b/platform/linux-generic/arch/mips64/odp_cpu_arch.c
new file mode 100644
index 0000000..a20a313
--- /dev/null
+++ b/platform/linux-generic/arch/mips64/odp_cpu_arch.c
@@ -0,0 +1,31 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/cpu.h>
+#include <odp/hints.h>
+#include <odp/system_info.h>
+
+uint64_t odp_cpu_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;
+}
+
+uint64_t odp_cpu_cycles_max(void)
+{
+       return UINT64_MAX;
+}
+
+uint64_t odp_cpu_cycles_resolution(void)
+{
+       return 1;
+}
diff --git a/platform/linux-generic/arch/mips64/odp_cpu_cycles.c 
b/platform/linux-generic/arch/mips64/odp_cpu_cycles.c
deleted file mode 100644
index a20a313..0000000
--- a/platform/linux-generic/arch/mips64/odp_cpu_cycles.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-#include <odp/cpu.h>
-#include <odp/hints.h>
-#include <odp/system_info.h>
-
-uint64_t odp_cpu_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;
-}
-
-uint64_t odp_cpu_cycles_max(void)
-{
-       return UINT64_MAX;
-}
-
-uint64_t odp_cpu_cycles_resolution(void)
-{
-       return 1;
-}
diff --git a/platform/linux-generic/arch/x86/odp_cpu_arch.c 
b/platform/linux-generic/arch/x86/odp_cpu_arch.c
new file mode 100644
index 0000000..1c5c0ec
--- /dev/null
+++ b/platform/linux-generic/arch/x86/odp_cpu_arch.c
@@ -0,0 +1,33 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+#include <odp/cpu.h>
+
+uint64_t odp_cpu_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;
+}
+
+uint64_t odp_cpu_cycles_max(void)
+{
+       return UINT64_MAX;
+}
+
+uint64_t odp_cpu_cycles_resolution(void)
+{
+       return 1;
+}
diff --git a/platform/linux-generic/arch/x86/odp_cpu_cycles.c 
b/platform/linux-generic/arch/x86/odp_cpu_cycles.c
deleted file mode 100644
index 1c5c0ec..0000000
--- a/platform/linux-generic/arch/x86/odp_cpu_cycles.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-#include <odp/cpu.h>
-
-uint64_t odp_cpu_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;
-}
-
-uint64_t odp_cpu_cycles_max(void)
-{
-       return UINT64_MAX;
-}
-
-uint64_t odp_cpu_cycles_resolution(void)
-{
-       return 1;
-}
-- 
2.6.3

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to