Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
Timing APIs

Timing Measurement APIs. More...

Functions

void timing_init (void)
 Initialize the timing subsystem. More...
 
void timing_start (void)
 Signal the start of the timing information gathering. More...
 
void timing_stop (void)
 Signal the end of the timing information gathering. More...
 
static timing_t timing_counter_get (void)
 Return timing counter. More...
 
static uint64_t timing_cycles_get (volatile timing_t *const start, volatile timing_t *const end)
 Get number of cycles between start and end. More...
 
static uint64_t timing_freq_get (void)
 Get frequency of counter used (in Hz). More...
 
static uint64_t timing_cycles_to_ns (uint64_t cycles)
 Convert number of cycles into nanoseconds. More...
 
static uint64_t timing_cycles_to_ns_avg (uint64_t cycles, uint32_t count)
 Convert number of cycles into nanoseconds with averaging. More...
 
static uint32_t timing_freq_get_mhz (void)
 Get frequency of counter used (in MHz). More...
 

Detailed Description

Timing Measurement APIs.

Function Documentation

◆ timing_counter_get()

static timing_t timing_counter_get ( void  )
inlinestatic

#include <include/timing/timing.h>

Return timing counter.

Returns
Timing counter.

◆ timing_cycles_get()

static uint64_t timing_cycles_get ( volatile timing_t *const  start,
volatile timing_t *const  end 
)
inlinestatic

#include <include/timing/timing.h>

Get number of cycles between start and end.

For some architectures or SoCs, the raw numbers from counter need to be scaled to obtain actual number of cycles.

Parameters
startPointer to counter at start of a measured execution.
endPointer to counter at stop of a measured execution.
Returns
Number of cycles between start and end.

◆ timing_cycles_to_ns()

static uint64_t timing_cycles_to_ns ( uint64_t  cycles)
inlinestatic

#include <include/timing/timing.h>

Convert number of cycles into nanoseconds.

Parameters
cyclesNumber of cycles
Returns
Converted time value

◆ timing_cycles_to_ns_avg()

static uint64_t timing_cycles_to_ns_avg ( uint64_t  cycles,
uint32_t  count 
)
inlinestatic

#include <include/timing/timing.h>

Convert number of cycles into nanoseconds with averaging.

Parameters
cyclesNumber of cycles
countTimes of accumulated cycles to average over
Returns
Converted time value

◆ timing_freq_get()

static uint64_t timing_freq_get ( void  )
inlinestatic

#include <include/timing/timing.h>

Get frequency of counter used (in Hz).

Returns
Frequency of counter used for timing in Hz.

◆ timing_freq_get_mhz()

static uint32_t timing_freq_get_mhz ( void  )
inlinestatic

#include <include/timing/timing.h>

Get frequency of counter used (in MHz).

Returns
Frequency of counter used for timing in MHz.

◆ timing_init()

void timing_init ( void  )

#include <include/timing/timing.h>

Initialize the timing subsystem.

Perform the necessary steps to initialize the timing subsystem.

◆ timing_start()

void timing_start ( void  )

#include <include/timing/timing.h>

Signal the start of the timing information gathering.

Signal to the timing subsystem that timing information will be gathered from this point forward.

◆ timing_stop()

void timing_stop ( void  )

#include <include/timing/timing.h>

Signal the end of the timing information gathering.

Signal to the timing subsystem that timing information is no longer being gathered from this point forward.