Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
Timing Measurement APIs. More...
Modules | |
Arch specific Timing Measurement APIs | |
Arch specific Timing Measurement APIs. | |
Board specific Timing Measurement APIs | |
Board specific Timing Measurement APIs. | |
SoC specific Timing Measurement APIs | |
SoC specific Timing Measurement APIs. | |
Functions | |
void | timing_init (void) |
Initialize the timing subsystem. | |
void | timing_start (void) |
Signal the start of the timing information gathering. | |
void | timing_stop (void) |
Signal the end of the timing information gathering. | |
static timing_t | timing_counter_get (void) |
Return timing counter. | |
static uint64_t | timing_cycles_get (volatile timing_t *const start, volatile timing_t *const end) |
Get number of cycles between start and end . | |
static uint64_t | timing_freq_get (void) |
Get frequency of counter used (in Hz). | |
static uint64_t | timing_cycles_to_ns (uint64_t cycles) |
Convert number of cycles into nanoseconds. | |
static uint64_t | timing_cycles_to_ns_avg (uint64_t cycles, uint32_t count) |
Convert number of cycles into nanoseconds with averaging. | |
static uint32_t | timing_freq_get_mhz (void) |
Get frequency of counter used (in MHz). | |
Timing Measurement APIs.
The timing measurement APIs can be used to obtain execution time of a section of code to aid in analysis and optimization.
Please note that the timing functions may use a different timer than the default kernel timer, where the timer being used is specified by architecture, SoC or board configuration.
|
inlinestatic |
|
inlinestatic |
#include <zephyr/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.
start | Pointer to counter at start of a measured execution. |
end | Pointer to counter at stop of a measured execution. |
#include <zephyr/timing/timing.h>
Convert number of cycles
into nanoseconds.
cycles | Number of cycles |
#include <zephyr/timing/timing.h>
Convert number of cycles
into nanoseconds with averaging.
cycles | Number of cycles |
count | Times of accumulated cycles to average over |
|
inlinestatic |
#include <zephyr/timing/timing.h>
Get frequency of counter used (in Hz).
|
inlinestatic |
#include <zephyr/timing/timing.h>
Get frequency of counter used (in MHz).
void timing_init | ( | void | ) |
#include <zephyr/timing/timing.h>
Initialize the timing subsystem.
Perform the necessary steps to initialize the timing subsystem.
void 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.
void 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.