On 08.09.15 11:31, Petri Savolainen wrote:
Renamed time_cycles files to cpu_cycles, since those files
implement cpu cycle counter read needed by cpu API but not
needed by new time API.

Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>

Reviewed-by: Ivan Khoronzhuk <ivan.khoronz...@linaro.org>

---
  platform/linux-generic/Makefile.am                 |  8 ++---
  platform/linux-generic/arch/linux/odp_cpu_cycles.c | 38 ++++++++++++++++++++++
  .../linux-generic/arch/linux/odp_time_cycles.c     | 38 ----------------------
  .../linux-generic/arch/mips64/odp_cpu_cycles.c     | 21 ++++++++++++
  .../linux-generic/arch/mips64/odp_time_cycles.c    | 21 ------------
  platform/linux-generic/arch/x86/odp_cpu_cycles.c   | 23 +++++++++++++
  platform/linux-generic/arch/x86/odp_time_cycles.c  | 23 -------------
  7 files changed, 86 insertions(+), 86 deletions(-)
  create mode 100644 platform/linux-generic/arch/linux/odp_cpu_cycles.c
  delete mode 100644 platform/linux-generic/arch/linux/odp_time_cycles.c
  create mode 100644 platform/linux-generic/arch/mips64/odp_cpu_cycles.c
  delete mode 100644 platform/linux-generic/arch/mips64/odp_time_cycles.c
  create mode 100644 platform/linux-generic/arch/x86/odp_cpu_cycles.c
  delete mode 100644 platform/linux-generic/arch/x86/odp_time_cycles.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 4c79730..c2a4778 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -167,9 +167,9 @@ __LIB__libodp_la_SOURCES = \
                           odp_timer.c \
                           odp_version.c \
                           odp_weak.c \
-                          arch/@ARCH@/odp_time_cycles.c
+                          arch/@ARCH@/odp_cpu_cycles.c

  EXTRA_DIST = \
-            arch/linux/odp_time_cycles.c \
-            arch/mips64/odp_time_cycles.c \
-            arch/x86/odp_time_cycles.c
+            arch/linux/odp_cpu_cycles.c \
+            arch/mips64/odp_cpu_cycles.c \
+            arch/x86/odp_cpu_cycles.c
diff --git a/platform/linux-generic/arch/linux/odp_cpu_cycles.c 
b/platform/linux-generic/arch/linux/odp_cpu_cycles.c
new file mode 100644
index 0000000..256ad7c
--- /dev/null
+++ b/platform/linux-generic/arch/linux/odp_cpu_cycles.c
@@ -0,0 +1,38 @@
+/* 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/time.h>
+#include <odp/hints.h>
+#include <odp/system_info.h>
+#include <odp_debug_internal.h>
+
+#define GIGA 1000000000
+
+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;
+}
diff --git a/platform/linux-generic/arch/linux/odp_time_cycles.c 
b/platform/linux-generic/arch/linux/odp_time_cycles.c
deleted file mode 100644
index 4dc0764..0000000
--- a/platform/linux-generic/arch/linux/odp_time_cycles.c
+++ /dev/null
@@ -1,38 +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/time.h>
-#include <odp/hints.h>
-#include <odp/system_info.h>
-#include <odp_debug_internal.h>
-
-#define GIGA 1000000000
-
-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;
-}
diff --git a/platform/linux-generic/arch/mips64/odp_cpu_cycles.c 
b/platform/linux-generic/arch/mips64/odp_cpu_cycles.c
new file mode 100644
index 0000000..4fb790b
--- /dev/null
+++ b/platform/linux-generic/arch/mips64/odp_cpu_cycles.c
@@ -0,0 +1,21 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/time.h>
+#include <odp/hints.h>
+#include <odp/system_info.h>
+
+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;
+}
diff --git a/platform/linux-generic/arch/mips64/odp_time_cycles.c 
b/platform/linux-generic/arch/mips64/odp_time_cycles.c
deleted file mode 100644
index 4fb790b..0000000
--- a/platform/linux-generic/arch/mips64/odp_time_cycles.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-#include <odp/time.h>
-#include <odp/hints.h>
-#include <odp/system_info.h>
-
-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;
-}
diff --git a/platform/linux-generic/arch/x86/odp_cpu_cycles.c 
b/platform/linux-generic/arch/x86/odp_cpu_cycles.c
new file mode 100644
index 0000000..a111561
--- /dev/null
+++ b/platform/linux-generic/arch/x86/odp_cpu_cycles.c
@@ -0,0 +1,23 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+#include <odp/time.h>
+
+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;
+}
diff --git a/platform/linux-generic/arch/x86/odp_time_cycles.c 
b/platform/linux-generic/arch/x86/odp_time_cycles.c
deleted file mode 100644
index a111561..0000000
--- a/platform/linux-generic/arch/x86/odp_time_cycles.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-#include <odp/time.h>
-
-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;
-}


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

Reply via email to