1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2015 Cavium, Inc
5 #include "eal_private.h"
6 #include "rte_cycles.h"
9 get_tsc_freq_arch(void)
11 #if defined RTE_ARCH_ARM64 && !defined RTE_ARM_EAL_RDTSC_USE_PMU
12 return __rte_arm64_cntfrq();
13 #elif defined RTE_ARCH_ARM64 && defined RTE_ARM_EAL_RDTSC_USE_PMU
14 #define CYC_PER_1MHZ 1E6
15 /* Use the generic counter ticks to calculate the PMU
19 uint64_t start_ticks, cur_ticks;
20 uint64_t start_pmu_cycles, end_pmu_cycles;
22 /* Number of ticks for 1/10 second */
23 ticks = __rte_arm64_cntfrq() / 10;
25 start_ticks = __rte_arm64_cntvct_precise();
26 start_pmu_cycles = rte_rdtsc_precise();
28 cur_ticks = __rte_arm64_cntvct();
29 } while ((cur_ticks - start_ticks) < ticks);
30 end_pmu_cycles = rte_rdtsc_precise();
32 /* Adjust the cycles to next 1Mhz */
33 return RTE_ALIGN_MUL_CEIL(end_pmu_cycles - start_pmu_cycles,