Using esp_timer_get_time() generates “wall clock” timestamps with microsecond precision, but has moderate overhead each time the timing functions are called. #include "esp_timer.h" void measure_important_function ( void ) Įxecuting the target multiple times can help average out factors, e.g., RTOS context switches, overhead of measurements, etc. Otherwise, one way to measure performance is to augment the code to take timing measurements: Or you can use an oscilloscope or logic analyzer to measure the timing of an interaction with a device peripheral. You may be able to measure directly the performance relative to an external interaction with the world, e.g., see the examples wifi/iperf and ethernet/iperf for measuring general network performance. The first step to improving something is to measure it. Optimization efforts should be targeted at these particular functions. Perhaps those functions are executed very often, or have to meet some application requirements for latency or throughput. Most kinds of application firmware only have a small set of functions that require optimal performance. If a function is executed constantly at 10 Hz, it matters greatly if it takes 10 ms or 100 ms to execute. If a function in the application firmware is executed once per week in the background, it may not matter if that function takes 10 ms or 100 ms to execute. However, improving execution speed may have trade-offs with other aspects of performance such as Minimizing Binary Size. Code that executes faster can also have other positive effects, e.g., reducing overall power consumption. Optimizing execution speed is a key element of software performance.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |