/* Copyright (c) 2015-2018, Linaro Limited * Copyright (c) 2021, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include #include #include #include #include #include #include #define GIGA 1000000000 #include 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_global_ro.system_info.cpu_hz_max[0]; sec = (uint64_t)time.tv_sec; ns = (uint64_t)time.tv_nsec; cycles = sec * hz; cycles += (ns * hz) / GIGA; return cycles; } int _odp_cpu_cycles_init_global(void) { return 0; }