Profiler
As the complexity of the application increases, performance issues such as low FPS and frequent cache misses causing lag may arise. LVGL has internally set up some hooks for performance measurement to help developers analyze and locate performance issues.
Porting
To enable profiler, set LV_USE_PROFILER
in lv_conf.h
and configure the following options:
LV_PROFILER_INCLUDE
: Provides a header file for the profiler function.LV_PROFILER_BEGIN
: Profiler start point function.LV_PROFILER_END
: Profiler end point function.
Example
The following is an example of output performance measurements using LVGL logging systems:
Configure lv_conf.h
:
#define LV_USE_PROFILER 1
#define LV_PROFILER_INCLUDE "lvgl/src/hal/lv_hal_tick.h"
#define LV_PROFILER_BEGIN uint32_t profiler_start = lv_tick_get()
#define LV_PROFILER_END LV_LOG_USER("cost %dms", (int)lv_tick_elaps(profiler_start))
Users can add the measured functions themselves:
LV_PROFILER_BEGIN;
my_func();
LV_PROFILER_END;