![]() |
Da Vinci Firmware 1
Firmware for the DaVinci-M rocket avionics board.
|
DWT-based microsecond profiler for ARM Cortex-M microcontrollers. More...
#include "main.h"

Go to the source code of this file.
Data Structures | |
| struct | ProfileResult |
Macros | |
| #define | ENABLE_PROFILING |
| #define | PROFILER_START(p_result) (p_result)->start_time = DWT->CYCCNT |
| #define | PROFILER_STOP(p_result) |
Functions | |
| void | initDWT (void) |
| Initializes the DWT (Data Watchpoint and Trace) cycle counter. | |
DWT-based microsecond profiler for ARM Cortex-M microcontrollers.
This header provides a set of macros to easily measure the execution time of code blocks with high precision using the DWT cycle counter.
— HOW TO USE —
ProfileResult variable: PROFILER_START and PROFILER_STOP macros: my_measurement variable. The results are available in cycles, nanoseconds, microseconds, and milliseconds. #define ENABLE_PROFILING line below. All profiling macros will compile to nothing, adding zero overhead. Definition in file profiler.h.
| #define ENABLE_PROFILING |
Definition at line 50 of file profiler.h.
| #define PROFILER_START | ( | p_result | ) | (p_result)->start_time = DWT->CYCCNT |
Definition at line 94 of file profiler.h.
| #define PROFILER_STOP | ( | p_result | ) |
Definition at line 97 of file profiler.h.
| void initDWT | ( | void | ) |
Initializes the DWT (Data Watchpoint and Trace) cycle counter.
This function enables the high-precision cycle counter available on ARM Cortex-M processors (M3, M4, M7, etc.). It is used for creating very short, accurate delays or for performance profiling. The counter increments on every CPU clock cycle.
It performs the following steps:
DWT_Delay_us()). Definition at line 70 of file profiler.h.
Referenced by main().
