xref: /dpdk/lib/eal/ppc/include/rte_cycles.h (revision 99a2dd95)
1 /*
2  * SPDX-License-Identifier: BSD-3-Clause
3  * Copyright (C) IBM Corporation 2014.
4  */
5 
6 #ifndef _RTE_CYCLES_PPC_64_H_
7 #define _RTE_CYCLES_PPC_64_H_
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #include <sys/platform/ppc.h>
14 
15 #include "generic/rte_cycles.h"
16 
17 #include <rte_byteorder.h>
18 #include <rte_common.h>
19 
20 /**
21  * Read the time base register.
22  *
23  * @return
24  *   The time base for this lcore.
25  */
26 static inline uint64_t
rte_rdtsc(void)27 rte_rdtsc(void)
28 {
29 	return __ppc_get_timebase();
30 }
31 
32 static inline uint64_t
rte_rdtsc_precise(void)33 rte_rdtsc_precise(void)
34 {
35 	rte_mb();
36 	return rte_rdtsc();
37 }
38 
39 static inline uint64_t
rte_get_tsc_cycles(void)40 rte_get_tsc_cycles(void) { return rte_rdtsc(); }
41 
42 #ifdef __cplusplus
43 }
44 #endif
45 
46 #endif /* _RTE_CYCLES_PPC_64_H_ */
47