1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(sysmon) disable all performance banners from screen with serial redirect

This removes all performance monitor banners from the screen when
LV_USE_PERF_MONITOR_LOG_MODE is used. This allows more precise
measurement of performance without interference from additional rendered objects

Signed-off-by: Cristian Stoica <cristianmarian.stoica@nxp.com>
This commit is contained in:
Cristian Stoica 2024-10-11 11:24:20 +03:00 committed by Gabor Kiss-Vamosi
parent 7d5cb8385e
commit 51e1dfcb40
2 changed files with 11 additions and 4 deletions

View File

@ -458,6 +458,9 @@ void lv_demo_benchmark(void)
#if LV_USE_PERF_MONITOR
lv_display_t * disp = lv_display_get_default();
lv_subject_add_observer_obj(&disp->perf_sysmon_backend.subject, sysmon_perf_observer_cb, title, NULL);
#if LV_USE_PERF_MONITOR_LOG_MODE
lv_obj_add_flag(title, LV_OBJ_FLAG_HIDDEN);
#endif
#else
lv_label_set_text(title, "LV_USE_PERF_MONITOR is not enabled");
#endif
@ -510,9 +513,8 @@ static void next_scene_timer_cb(lv_timer_t * timer)
static void sysmon_perf_observer_cb(lv_observer_t * observer, lv_subject_t * subject)
{
const lv_sysmon_perf_info_t * info = lv_subject_get_pointer(subject);
lv_obj_t * label = lv_observer_get_target(observer);
char scene_name[64];
if(scenes[scene_act].name[0] != '\0') {
lv_snprintf(scene_name, sizeof(scene_name), "%s: ", scenes[scene_act].name);
}
@ -520,6 +522,8 @@ static void sysmon_perf_observer_cb(lv_observer_t * observer, lv_subject_t * sub
scene_name[0] = '\0';
}
#if !LV_USE_PERF_MONITOR_LOG_MODE
lv_obj_t * label = lv_observer_get_target(observer);
lv_label_set_text_fmt(label,
"%s"
"%" LV_PRIu32" FPS, %" LV_PRIu32 "%% CPU\n"
@ -528,6 +532,9 @@ static void sysmon_perf_observer_cb(lv_observer_t * observer, lv_subject_t * sub
info->calculated.fps, info->calculated.cpu,
info->calculated.render_avg_time + info->calculated.flush_avg_time,
info->calculated.render_avg_time, info->calculated.flush_avg_time);
#else
LV_UNUSED(observer);
#endif
/*Ignore the first call as it contains data from the previous scene*/
if(scenes[scene_act].measurement_cnt != 0) {

View File

@ -277,11 +277,10 @@ static void perf_update_timer_cb(lv_timer_t * t)
static void perf_observer_cb(lv_observer_t * observer, lv_subject_t * subject)
{
lv_obj_t * label = lv_observer_get_target(observer);
const lv_sysmon_perf_info_t * perf = lv_subject_get_pointer(subject);
#if LV_USE_PERF_MONITOR_LOG_MODE
LV_UNUSED(label);
LV_UNUSED(observer);
LV_LOG("sysmon: "
"%" LV_PRIu32 " FPS (refr_cnt: %" LV_PRIu32 " | redraw_cnt: %" LV_PRIu32"), "
"refr %" LV_PRIu32 "ms (render %" LV_PRIu32 "ms | flush %" LV_PRIu32 "ms), "
@ -290,6 +289,7 @@ static void perf_observer_cb(lv_observer_t * observer, lv_subject_t * subject)
perf->calculated.refr_avg_time, perf->calculated.render_avg_time, perf->calculated.flush_avg_time,
perf->calculated.cpu);
#else
lv_obj_t * label = lv_observer_get_target(observer);
lv_label_set_text_fmt(
label,
"%" LV_PRIu32" FPS, %" LV_PRIu32 "%% CPU\n"