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

Arch specific Timing Measurement APIs. More...

Functions

void arch_timing_init (void)
 Initialize the timing subsystem.
 
void arch_timing_start (void)
 Signal the start of the timing information gathering.
 
void arch_timing_stop (void)
 Signal the end of the timing information gathering.
 
timing_t arch_timing_counter_get (void)
 Return timing counter.
 
uint64_t arch_timing_cycles_get (volatile timing_t *const start, volatile timing_t *const end)
 Get number of cycles between start and end.
 
uint64_t arch_timing_freq_get (void)
 Get frequency of counter used (in Hz).
 
uint64_t arch_timing_cycles_to_ns (uint64_t cycles)
 Convert number of cycles into nanoseconds.
 
uint64_t arch_timing_cycles_to_ns_avg (uint64_t cycles, uint32_t count)
 Convert number of cycles into nanoseconds with averaging.
 
uint32_t arch_timing_freq_get_mhz (void)
 Get frequency of counter used (in MHz).
 

Detailed Description

Arch specific Timing Measurement APIs.

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

Function Documentation

◆ arch_timing_counter_get()

timing_t arch_timing_counter_get ( void  )

#include <include/zephyr/arch/arch_interface.h>

Return timing counter.

Note
Any call to arch_timing_counter_get() must be done between calls to arch_timing_start() and arch_timing_stop(), and on the same CPU core.

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

◆ arch_timing_cycles_get()

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

#include <include/zephyr/arch/arch_interface.h>

Get number of cycles between start and end.

Note
For some architectures, 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()

◆ arch_timing_cycles_to_ns()

uint64_t arch_timing_cycles_to_ns ( uint64_t  cycles)

#include <include/zephyr/arch/arch_interface.h>

Convert number of cycles into nanoseconds.

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

◆ arch_timing_cycles_to_ns_avg()

uint64_t arch_timing_cycles_to_ns_avg ( uint64_t  cycles,
uint32_t  count 
)

#include <include/zephyr/arch/arch_interface.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()

◆ arch_timing_freq_get()

uint64_t arch_timing_freq_get ( void  )

#include <include/zephyr/arch/arch_interface.h>

Get frequency of counter used (in Hz).

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

◆ arch_timing_freq_get_mhz()

uint32_t arch_timing_freq_get_mhz ( void  )

#include <include/zephyr/arch/arch_interface.h>

Get frequency of counter used (in MHz).

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

◆ arch_timing_init()

void arch_timing_init ( void  )

#include <include/zephyr/arch/arch_interface.h>

Initialize the timing subsystem.

Perform the necessary steps to initialize the timing subsystem.

See also
timing_init()

◆ arch_timing_start()

void arch_timing_start ( void  )

#include <include/zephyr/arch/arch_interface.h>

Signal the start of the timing information gathering.

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

Note
Any call to arch_timing_counter_get() must be done between calls to arch_timing_start() and arch_timing_stop(), and on the same CPU core.
See also
timing_start()

◆ arch_timing_stop()

void arch_timing_stop ( void  )

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

Note
Any call to arch_timing_counter_get() must be done between calls to arch_timing_start() and arch_timing_stop(), and on the same CPU core.
See also
timing_stop()