DPDK  20.11.3
Functions | Variables
rte_cycles.h File Reference
#include <stdint.h>
#include <rte_compat.h>
#include <rte_debug.h>
#include <rte_atomic.h>

Go to the source code of this file.

Functions

uint64_t rte_get_tsc_hz (void)
 
static uint64_t rte_get_tsc_cycles (void)
 
static uint64_t rte_get_timer_cycles (void)
 
static uint64_t rte_get_timer_hz (void)
 
static void rte_delay_ms (unsigned ms)
 
void rte_delay_us_block (unsigned int us)
 
__rte_experimental void rte_delay_us_sleep (unsigned int us)
 
void rte_delay_us_callback_register (void(*userfunc)(unsigned int))
 

Variables

void(* rte_delay_us )(unsigned int us)
 

Detailed Description

Simple Time Reference Functions (Cycles and HPET).

Definition in file rte_cycles.h.

Function Documentation

◆ rte_get_tsc_hz()

uint64_t rte_get_tsc_hz ( void  )

◆ rte_get_tsc_cycles()

static uint64_t rte_get_tsc_cycles ( void  )
inlinestatic

Return the number of TSC cycles since boot

Returns
the number of cycles
Examples:
examples/ip_pipeline/thread.c, and examples/pipeline/thread.c.

◆ rte_get_timer_cycles()

static uint64_t rte_get_timer_cycles ( void  )
inlinestatic

Get the number of cycles since boot from the default timer.

Returns
The number of cycles
Examples:
examples/l2fwd-jobstats/main.c, and examples/timer/main.c.

Definition at line 94 of file rte_cycles.h.

◆ rte_get_timer_hz()

static uint64_t rte_get_timer_hz ( void  )
inlinestatic

Get the number of cycles in one second for the default timer.

Returns
The number of cycles in one second.
Examples:
examples/distributor/main.c, examples/l2fwd-event/main.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-power/main.c, examples/qos_sched/init.c, and examples/timer/main.c.

Definition at line 116 of file rte_cycles.h.

◆ rte_delay_ms()

static void rte_delay_ms ( unsigned  ms)
inlinestatic

◆ rte_delay_us_block()

void rte_delay_us_block ( unsigned int  us)

Blocking delay function.

Parameters
usNumber of microseconds to wait.

◆ rte_delay_us_sleep()

__rte_experimental void rte_delay_us_sleep ( unsigned int  us)

Delay function that uses system sleep. Does not block the CPU core.

Parameters
usNumber of microseconds to wait.

◆ rte_delay_us_callback_register()

void rte_delay_us_callback_register ( void(*)(unsigned int)  userfunc)

Replace rte_delay_us with user defined function.

Parameters
userfuncUser function which replaces rte_delay_us. rte_delay_us_block restores builtin block delay function.

Variable Documentation

◆ rte_delay_us

void(* rte_delay_us) (unsigned int us)

Wait at least us microseconds. This function can be replaced with user-defined function.

See also
rte_delay_us_callback_register
Parameters
usThe number of microseconds to wait.
Examples:
examples/bond/main.c, examples/l3fwd-power/main.c, examples/ntb/ntb_fwd.c, examples/ptpclient/ptpclient.c, examples/service_cores/main.c, examples/vhost/main.c, and examples/vm_power_manager/channel_monitor.c.