diff --git a/demos/benchmark/lv_demo_benchmark.c b/demos/benchmark/lv_demo_benchmark.c index 4838e1594..7c0d41abd 100644 --- a/demos/benchmark/lv_demo_benchmark.c +++ b/demos/benchmark/lv_demo_benchmark.c @@ -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) { diff --git a/src/others/sysmon/lv_sysmon.c b/src/others/sysmon/lv_sysmon.c index 1814dddf9..803ce8c5e 100644 --- a/src/others/sysmon/lv_sysmon.c +++ b/src/others/sysmon/lv_sysmon.c @@ -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"