DPDK
18.05.1
Main Page
Related Pages
Data Structures
Files
Examples
File List
Globals
lib
librte_eal
common
include
generic
rte_cycles.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-3-Clause
2
* Copyright(c) 2010-2014 Intel Corporation.
3
* Copyright(c) 2013 6WIND S.A.
4
*/
5
6
#ifndef _RTE_CYCLES_H_
7
#define _RTE_CYCLES_H_
8
15
#include <stdint.h>
16
#include <
rte_debug.h
>
17
#include <
rte_atomic.h
>
18
19
#define MS_PER_S 1000
20
#define US_PER_S 1000000
21
#define NS_PER_S 1000000000
22
23
enum
timer_source {
24
EAL_TIMER_TSC = 0,
25
EAL_TIMER_HPET
26
};
27
extern
enum
timer_source eal_timer_source;
28
35
uint64_t
36
rte_get_tsc_hz
(
void
);
37
44
static
inline
uint64_t
45
rte_get_tsc_cycles
(
void
);
46
47
#ifdef RTE_LIBEAL_USE_HPET
48
57
uint64_t
58
rte_get_hpet_cycles(
void
);
59
66
uint64_t
67
rte_get_hpet_hz(
void
);
68
82
int
rte_eal_hpet_init(
int
make_default);
83
84
#endif
85
92
static
inline
uint64_t
93
rte_get_timer_cycles
(
void
)
94
{
95
#ifdef RTE_LIBEAL_USE_HPET
96
switch
(eal_timer_source) {
97
case
EAL_TIMER_TSC:
98
#endif
99
return
rte_get_tsc_cycles
();
100
#ifdef RTE_LIBEAL_USE_HPET
101
case
EAL_TIMER_HPET:
102
return
rte_get_hpet_cycles();
103
default
:
rte_panic
(
"Invalid timer source specified\n"
);
104
}
105
#endif
106
}
107
114
static
inline
uint64_t
115
rte_get_timer_hz
(
void
)
116
{
117
#ifdef RTE_LIBEAL_USE_HPET
118
switch
(eal_timer_source) {
119
case
EAL_TIMER_TSC:
120
#endif
121
return
rte_get_tsc_hz
();
122
#ifdef RTE_LIBEAL_USE_HPET
123
case
EAL_TIMER_HPET:
124
return
rte_get_hpet_hz();
125
default
:
rte_panic
(
"Invalid timer source specified\n"
);
126
}
127
#endif
128
}
137
extern
void
138
(*rte_delay_us)(
unsigned
int
us);
139
146
static
inline
void
147
rte_delay_ms
(
unsigned
ms)
148
{
149
rte_delay_us
(ms * 1000);
150
}
151
158
void
rte_delay_us_block
(
unsigned
int
us);
159
167
void
rte_delay_us_callback_register
(
void
(*userfunc)(
unsigned
int
));
168
169
#endif
/* _RTE_CYCLES_H_ */
Generated by
1.8.1.2