@@ -224,37 +224,32 @@ __LIB__libodp_linux_la_SOURCES = \
odp_weak.c
if ARCH_IS_ARM
-__LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \
- arch/default/odp_cpu_cycles.c \
+__LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_cycles.c \
arch/default/odp_global_time.c \
arch/default/odp_sysinfo_parse.c
arch_odp_headers = arch/arm/odp/api/cpu_arch.h
endif
if ARCH_IS_AARCH64
-__LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \
- arch/default/odp_cpu_cycles.c \
+__LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_cycles.c \
arch/aarch64/odp_global_time.c \
arch/default/odp_sysinfo_parse.c
arch_odp_headers = arch/aarch64/odp/api/cpu_arch.h
endif
if ARCH_IS_MIPS64
-__LIB__libodp_linux_la_SOURCES += arch/mips64/odp_cpu_arch.c \
- arch/default/odp_cpu_cycles.c \
+__LIB__libodp_linux_la_SOURCES += arch/mips64/odp_cpu_cycles.c \
arch/default/odp_global_time.c \
arch/mips64/odp_sysinfo_parse.c
arch_odp_headers = arch/mips64/odp/api/cpu_arch.h
endif
if ARCH_IS_POWERPC
-__LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \
- arch/default/odp_cpu_cycles.c \
+__LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_cycles.c \
arch/default/odp_global_time.c \
arch/powerpc/odp_sysinfo_parse.c
arch_odp_headers = arch/powerpc/odp/api/cpu_arch.h
endif
if ARCH_IS_X86
__LIB__libodp_linux_la_SOURCES += arch/x86/cpu_flags.c \
- arch/x86/odp_cpu_arch.c \
- arch/default/odp_cpu_cycles.c \
+ arch/x86/odp_cpu_cycles.c \
arch/x86/odp_global_time.c \
arch/x86/odp_sysinfo_parse.c
arch_odp_headers = arch/x86/odp/api/cpu_arch.h
deleted file mode 100644
@@ -1,38 +0,0 @@
-/* Copyright (c) 2015, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include "config.h"
-
-#include <odp_posix_extensions.h>
-
-#include <stdlib.h>
-#include <time.h>
-
-#include <odp/api/cpu.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;
-}
@@ -6,7 +6,36 @@
#include "config.h"
+#include <odp_posix_extensions.h>
+
+#include <stdlib.h>
+#include <time.h>
+
#include <odp/api/cpu.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)
{
similarity index 79%
rename from platform/linux-generic/arch/mips64/odp_cpu_arch.c
rename to platform/linux-generic/arch/mips64/odp_cpu_cycles.c
@@ -21,3 +21,13 @@ uint64_t odp_cpu_cycles(void)
return cycle;
}
+
+uint64_t odp_cpu_cycles_max(void)
+{
+ return UINT64_MAX;
+}
+
+uint64_t odp_cpu_cycles_resolution(void)
+{
+ return 1;
+}
similarity index 77%
rename from platform/linux-generic/arch/x86/odp_cpu_arch.c
rename to platform/linux-generic/arch/x86/odp_cpu_cycles.c
@@ -4,14 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include "config.h"
-
-#include <odp_posix_extensions.h>
-
#include <odp/api/cpu.h>
-#include <odp_debug_internal.h>
-
-#include <time.h>
uint64_t odp_cpu_cycles(void)
{
@@ -29,3 +22,13 @@ uint64_t odp_cpu_cycles(void)
return tsc.tsc_64;
}
+
+uint64_t odp_cpu_cycles_max(void)
+{
+ return UINT64_MAX;
+}
+
+uint64_t odp_cpu_cycles_resolution(void)
+{
+ return 1;
+}