fix(benchmark): use the correct subject for performance data (#6237)

This commit is contained in:
Gabor Kiss-Vamosi
2024-05-27 06:46:48 +02:00
committed by GitHub
parent 64598041be
commit 7a13d56c59
3 changed files with 7 additions and 13 deletions

View File

@@ -418,8 +418,6 @@ static scene_dsc_t scenes[] = {
{.name = "", .create_cb = NULL}
};
#define sysmon_perf LV_GLOBAL_DEFAULT()->sysmon_perf
static uint32_t scene_act;
static uint32_t rnd_act;
@@ -455,7 +453,8 @@ void lv_demo_benchmark(void)
lv_timer_create(next_scene_timer_cb, scenes[0].scene_time, NULL);
#if LV_USE_PERF_MONITOR
lv_subject_add_observer_obj(&sysmon_perf.subject, sysmon_perf_observer_cb, title, NULL);
lv_display_t * disp = lv_display_get_default();
lv_subject_add_observer_obj(&disp->perf_sysmon_backend.subject, sysmon_perf_observer_cb, title, NULL);
#else
lv_label_set_text(title, "LV_USE_PERF_MONITOR is not enabled");
#endif

View File

@@ -12,7 +12,9 @@
#include "lv_demo_music_main.h"
#include "lv_demo_music_list.h"
#include "../../src/core/lv_global.h"
#if LV_DEMO_MUSIC_AUTO_PLAY && LV_USE_PERF_MONITOR
#include "../../src/display/lv_display_private.h"
#endif
/*********************
* DEFINES
@@ -104,10 +106,6 @@ static const uint32_t time_list[] = {
2 * 60 + 19,
};
#if LV_USE_PERF_MONITOR || LV_DEMO_MUSIC_AUTO_PLAY
#define sysmon_perf LV_GLOBAL_DEFAULT()->sysmon_perf
#endif
/**********************
* MACROS
**********************/
@@ -230,7 +228,8 @@ static void auto_step_cb(lv_timer_t * t)
lv_obj_t * num = lv_label_create(bg);
lv_obj_set_style_text_font(num, font_large, 0);
#if LV_USE_PERF_MONITOR
const lv_sysmon_perf_info_t * info = lv_subject_get_pointer(&sysmon_perf.subject);
lv_display_t * disp = lv_display_get_default();
const lv_sysmon_perf_info_t * info = lv_subject_get_pointer(&disp->perf_sysmon_backend.subject);
lv_label_set_text_fmt(num, "%" LV_PRIu32, info->calculated.fps_avg_total);
#endif
lv_obj_align(num, LV_ALIGN_TOP_MID, 0, 120);