Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
SoC specific Timing Measurement APIs

SoC specific Timing Measurement APIs. More...

Functions

void soc_timing_init (void)
 Initialize the timing subsystem on SoC.
 
void soc_timing_start (void)
 Signal the start of the timing information gathering.
 
void soc_timing_stop (void)
 Signal the end of the timing information gathering.
 
timing_t soc_timing_counter_get (void)
 Return timing counter.
 
uint64_t soc_timing_cycles_get (volatile timing_t *const start, volatile timing_t *const end)
 Get number of cycles between start and end.
 
uint64_t soc_timing_freq_get (void)
 Get frequency of counter used (in Hz).
 
uint64_t soc_timing_cycles_to_ns (uint64_t cycles)
 Convert number of cycles into nanoseconds.
 
uint64_t soc_timing_cycles_to_ns_avg (uint64_t cycles, uint32_t count)
 Convert number of cycles into nanoseconds with averaging.
 
uint32_t soc_timing_freq_get_mhz (void)
 Get frequency of counter used (in MHz).
 

Detailed Description

SoC specific Timing Measurement APIs.

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

Function Documentation

◆ soc_timing_counter_get()

timing_t soc_timing_counter_get ( void  )

#include <include/zephyr/timing/timing.h>

Return timing counter.

Note
Not all SoCs have timing counters with 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 SoC dependent code, e.g. by casting to a uint32_t before subtraction) or by using soc_timing_cycles_get() which is required to understand the distinction.
Returns
Timing counter.
See also
timing_counter_get()

◆ soc_timing_cycles_get()

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

#include <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()

◆ soc_timing_cycles_to_ns()

uint64_t soc_timing_cycles_to_ns ( uint64_t  cycles)

#include <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()

◆ soc_timing_cycles_to_ns_avg()

uint64_t soc_timing_cycles_to_ns_avg ( uint64_t  cycles,
uint32_t  count 
)

#include <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()

◆ soc_timing_freq_get()

uint64_t soc_timing_freq_get ( void  )

#include <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()

◆ soc_timing_freq_get_mhz()

uint32_t soc_timing_freq_get_mhz ( void  )

#include <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()

◆ soc_timing_init()

void soc_timing_init ( void  )

#include <include/zephyr/timing/timing.h>

Initialize the timing subsystem on SoC.

Perform the necessary steps to initialize the timing subsystem.

See also
timing_init()

◆ soc_timing_start()

void soc_timing_start ( void  )

#include <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()

◆ soc_timing_stop()

void soc_timing_stop ( void  )

#include <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()