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:
committed by
Gabor Kiss-Vamosi
parent
7d5cb8385e
commit
51e1dfcb40
@@ -458,6 +458,9 @@ void lv_demo_benchmark(void)
|
|||||||
#if LV_USE_PERF_MONITOR
|
#if LV_USE_PERF_MONITOR
|
||||||
lv_display_t * disp = lv_display_get_default();
|
lv_display_t * disp = lv_display_get_default();
|
||||||
lv_subject_add_observer_obj(&disp->perf_sysmon_backend.subject, sysmon_perf_observer_cb, title, NULL);
|
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
|
#else
|
||||||
lv_label_set_text(title, "LV_USE_PERF_MONITOR is not enabled");
|
lv_label_set_text(title, "LV_USE_PERF_MONITOR is not enabled");
|
||||||
#endif
|
#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)
|
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);
|
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];
|
char scene_name[64];
|
||||||
|
|
||||||
if(scenes[scene_act].name[0] != '\0') {
|
if(scenes[scene_act].name[0] != '\0') {
|
||||||
lv_snprintf(scene_name, sizeof(scene_name), "%s: ", scenes[scene_act].name);
|
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';
|
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,
|
lv_label_set_text_fmt(label,
|
||||||
"%s"
|
"%s"
|
||||||
"%" LV_PRIu32" FPS, %" LV_PRIu32 "%% CPU\n"
|
"%" 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.fps, info->calculated.cpu,
|
||||||
info->calculated.render_avg_time + info->calculated.flush_avg_time,
|
info->calculated.render_avg_time + info->calculated.flush_avg_time,
|
||||||
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*/
|
/*Ignore the first call as it contains data from the previous scene*/
|
||||||
if(scenes[scene_act].measurement_cnt != 0) {
|
if(scenes[scene_act].measurement_cnt != 0) {
|
||||||
|
|||||||
@@ -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)
|
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);
|
const lv_sysmon_perf_info_t * perf = lv_subject_get_pointer(subject);
|
||||||
|
|
||||||
#if LV_USE_PERF_MONITOR_LOG_MODE
|
#if LV_USE_PERF_MONITOR_LOG_MODE
|
||||||
LV_UNUSED(label);
|
LV_UNUSED(observer);
|
||||||
LV_LOG("sysmon: "
|
LV_LOG("sysmon: "
|
||||||
"%" LV_PRIu32 " FPS (refr_cnt: %" LV_PRIu32 " | redraw_cnt: %" LV_PRIu32"), "
|
"%" LV_PRIu32 " FPS (refr_cnt: %" LV_PRIu32 " | redraw_cnt: %" LV_PRIu32"), "
|
||||||
"refr %" LV_PRIu32 "ms (render %" LV_PRIu32 "ms | flush %" LV_PRIu32 "ms), "
|
"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.refr_avg_time, perf->calculated.render_avg_time, perf->calculated.flush_avg_time,
|
||||||
perf->calculated.cpu);
|
perf->calculated.cpu);
|
||||||
#else
|
#else
|
||||||
|
lv_obj_t * label = lv_observer_get_target(observer);
|
||||||
lv_label_set_text_fmt(
|
lv_label_set_text_fmt(
|
||||||
label,
|
label,
|
||||||
"%" LV_PRIu32" FPS, %" LV_PRIu32 "%% CPU\n"
|
"%" LV_PRIu32" FPS, %" LV_PRIu32 "%% CPU\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user