Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Board specific Timing Measurement APIs

Board specific Timing Measurement APIs. More...

Functions

void board_timing_init (void)
 Initialize the timing subsystem.
 
void board_timing_start (void)
 Signal the start of the timing information gathering.
 
void board_timing_stop (void)
 Signal the end of the timing information gathering.
 
timing_t board_timing_counter_get (void)
 Return timing counter.
 
uint64_t board_timing_cycles_get (volatile timing_t *const start, volatile timing_t *const end)
 Get number of cycles between start and end.
 
uint64_t board_timing_freq_get (void)
 Get frequency of counter used (in Hz).
 
uint64_t board_timing_cycles_to_ns (uint64_t cycles)
 Convert number of cycles into nanoseconds.
 
uint64_t board_timing_cycles_to_ns_avg (uint64_t cycles, uint32_t count)
 Convert number of cycles into nanoseconds with averaging.
 
uint32_t board_timing_freq_get_mhz (void)
 Get frequency of counter used (in MHz).
 

Detailed Description

Board specific Timing Measurement APIs.

Implements the necessary bits to support timing measurement using board specific timing measurement mechanism.

Function Documentation

◆ board_timing_counter_get()

timing_t board_timing_counter_get ( void  )

#include <zephyr/timing/timing.h>

Return timing counter.

Note
Not all timing counters have 64 bit precision. It is possible to see this value "go backwards" due to internal rollover. Timing code must be prepared to address the rollover (with board dependent code, e.g. by casting to a uint32_t before subtraction) or by using board_timing_cycles_get() which is required to understand the distinction.
Returns
Timing counter.
See also
timing_counter_get()

◆ board_timing_cycles_get()

uint64_t board_timing_cycles_get ( volatile timing_t *const  start,
volatile timing_t *const  end 
)

#include <zephyr/timing/timing.h>

Get number of cycles between start and end.

Note
The raw numbers from counter need to be scaled to obtain actual number of cycles, or may roll over internally. This function computes a positive-definite interval between two returned cycle values.
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.
See also
timing_cycles_get()

◆ board_timing_cycles_to_ns()

uint64_t board_timing_cycles_to_ns ( uint64_t  cycles)

#include <zephyr/timing/timing.h>

Convert number of cycles into nanoseconds.

Parameters
cyclesNumber of cycles
Returns
Converted time value
See also
timing_cycles_to_ns()

◆ board_timing_cycles_to_ns_avg()

uint64_t board_timing_cycles_to_ns_avg ( uint64_t  cycles,
uint32_t  count 
)

#include <zephyr/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
See also
timing_cycles_to_ns_avg()

◆ board_timing_freq_get()

uint64_t board_timing_freq_get ( void  )

#include <zephyr/timing/timing.h>

Get frequency of counter used (in Hz).

Returns
Frequency of counter used for timing in Hz.
See also
timing_freq_get()

◆ board_timing_freq_get_mhz()

uint32_t board_timing_freq_get_mhz ( void  )

#include <zephyr/timing/timing.h>

Get frequency of counter used (in MHz).

Returns
Frequency of counter used for timing in MHz.
See also
timing_freq_get_mhz()

◆ board_timing_init()

void board_timing_init ( void  )

#include <zephyr/timing/timing.h>

Initialize the timing subsystem.

Perform the necessary steps to initialize the timing subsystem.

See also
timing_init()

◆ board_timing_start()

void board_timing_start ( void  )

#include <zephyr/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.

See also
timing_start()

◆ board_timing_stop()

void board_timing_stop ( void  )

#include <zephyr/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.

See also
timing_stop()