1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-02-04 07:13:00 +08:00

fix(conf): mode LV_USE_SYSMON and LV_USE_PEFRF/MEM_MONITOR closer (#5314)

This commit is contained in:
Gabor Kiss-Vamosi 2024-01-15 13:50:01 +01:00 committed by GitHub
parent b1d1498790
commit c7bece7d98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 157 additions and 159 deletions

128
Kconfig
View File

@ -493,70 +493,6 @@ menu "LVGL configuration"
bool "Use float as lv_value_precise_t." bool "Use float as lv_value_precise_t."
default n default n
config LV_USE_PERF_MONITOR
bool "Show CPU usage and FPS count."
depends on LV_USE_SYSMON
choice
prompt "Performance monitor position."
depends on LV_USE_PERF_MONITOR
default LV_PERF_MONITOR_ALIGN_BOTTOM_RIGHT
config LV_PERF_MONITOR_ALIGN_TOP_LEFT
bool "Top left"
config LV_PERF_MONITOR_ALIGN_TOP_MID
bool "Top middle"
config LV_PERF_MONITOR_ALIGN_TOP_RIGHT
bool "Top right"
config LV_PERF_MONITOR_ALIGN_BOTTOM_LEFT
bool "Bottom left"
config LV_PERF_MONITOR_ALIGN_BOTTOM_MID
bool "Bottom middle"
config LV_PERF_MONITOR_ALIGN_BOTTOM_RIGHT
bool "Bottom right"
config LV_PERF_MONITOR_ALIGN_LEFT_MID
bool "Left middle"
config LV_PERF_MONITOR_ALIGN_RIGHT_MID
bool "Right middle"
config LV_PERF_MONITOR_ALIGN_CENTER
bool "Center"
endchoice
config LV_USE_PERF_MONITOR_LOG_MODE
bool "Prints performance data using log"
depends on LV_USE_PERF_MONITOR
default n
config LV_USE_MEM_MONITOR
bool "Show the used memory and the memory fragmentation."
depends on !LV_MEM_CUSTOM
depends on LV_USE_SYSMON
choice
prompt "Memory monitor position."
depends on LV_USE_MEM_MONITOR
default LV_MEM_MONITOR_ALIGN_BOTTOM_LEFT
config LV_MEM_MONITOR_ALIGN_TOP_LEFT
bool "Top left"
config LV_MEM_MONITOR_ALIGN_TOP_MID
bool "Top middle"
config LV_MEM_MONITOR_ALIGN_TOP_RIGHT
bool "Top right"
config LV_MEM_MONITOR_ALIGN_BOTTOM_LEFT
bool "Bottom left"
config LV_MEM_MONITOR_ALIGN_BOTTOM_MID
bool "Bottom middle"
config LV_MEM_MONITOR_ALIGN_BOTTOM_RIGHT
bool "Bottom right"
config LV_MEM_MONITOR_ALIGN_LEFT_MID
bool "Left middle"
config LV_MEM_MONITOR_ALIGN_RIGHT_MID
bool "Right middle"
config LV_MEM_MONITOR_ALIGN_CENTER
bool "Center"
endchoice
config LV_USE_REFR_DEBUG config LV_USE_REFR_DEBUG
bool "Draw random colored rectangles over the redrawn areas." bool "Draw random colored rectangles over the redrawn areas."
@ -1192,6 +1128,70 @@ menu "LVGL configuration"
bool "Enable system monitor component" bool "Enable system monitor component"
default n default n
config LV_USE_PERF_MONITOR
bool "Show CPU usage and FPS count."
depends on LV_USE_SYSMON
choice
prompt "Performance monitor position."
depends on LV_USE_PERF_MONITOR
default LV_PERF_MONITOR_ALIGN_BOTTOM_RIGHT
config LV_PERF_MONITOR_ALIGN_TOP_LEFT
bool "Top left"
config LV_PERF_MONITOR_ALIGN_TOP_MID
bool "Top middle"
config LV_PERF_MONITOR_ALIGN_TOP_RIGHT
bool "Top right"
config LV_PERF_MONITOR_ALIGN_BOTTOM_LEFT
bool "Bottom left"
config LV_PERF_MONITOR_ALIGN_BOTTOM_MID
bool "Bottom middle"
config LV_PERF_MONITOR_ALIGN_BOTTOM_RIGHT
bool "Bottom right"
config LV_PERF_MONITOR_ALIGN_LEFT_MID
bool "Left middle"
config LV_PERF_MONITOR_ALIGN_RIGHT_MID
bool "Right middle"
config LV_PERF_MONITOR_ALIGN_CENTER
bool "Center"
endchoice
config LV_USE_PERF_MONITOR_LOG_MODE
bool "Prints performance data using log"
depends on LV_USE_PERF_MONITOR
default n
config LV_USE_MEM_MONITOR
bool "Show the used memory and the memory fragmentation."
depends on !LV_MEM_CUSTOM
depends on LV_USE_SYSMON
choice
prompt "Memory monitor position."
depends on LV_USE_MEM_MONITOR
default LV_MEM_MONITOR_ALIGN_BOTTOM_LEFT
config LV_MEM_MONITOR_ALIGN_TOP_LEFT
bool "Top left"
config LV_MEM_MONITOR_ALIGN_TOP_MID
bool "Top middle"
config LV_MEM_MONITOR_ALIGN_TOP_RIGHT
bool "Top right"
config LV_MEM_MONITOR_ALIGN_BOTTOM_LEFT
bool "Bottom left"
config LV_MEM_MONITOR_ALIGN_BOTTOM_MID
bool "Bottom middle"
config LV_MEM_MONITOR_ALIGN_BOTTOM_RIGHT
bool "Bottom right"
config LV_MEM_MONITOR_ALIGN_LEFT_MID
bool "Left middle"
config LV_MEM_MONITOR_ALIGN_RIGHT_MID
bool "Right middle"
config LV_MEM_MONITOR_ALIGN_CENTER
bool "Center"
endchoice
config LV_USE_MONKEY config LV_USE_MONKEY
bool "Enable Monkey test" bool "Enable Monkey test"
default n default n

View File

@ -255,28 +255,6 @@
*For layers add the index number of the draw unit on black background.*/ *For layers add the index number of the draw unit on black background.*/
#define LV_USE_PARALLEL_DRAW_DEBUG 0 #define LV_USE_PARALLEL_DRAW_DEBUG 0
/*------------------
* STATUS MONITORING
*------------------*/
/*1: Show CPU usage and FPS count
* Requires `LV_USE_SYSMON = 1`*/
#define LV_USE_PERF_MONITOR 0
#if LV_USE_PERF_MONITOR
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
/*0: Displays performance data on the screen, 1: Prints performance data using log.*/
#define LV_USE_PERF_MONITOR_LOG_MODE 0
#endif
/*1: Show the used memory and the memory fragmentation
* Requires `LV_USE_BUILTIN_MALLOC = 1`
* Requires `LV_USE_SYSMON = 1`*/
#define LV_USE_MEM_MONITOR 0
#if LV_USE_MEM_MONITOR
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
#endif
/*------------- /*-------------
* Others * Others
*-----------*/ *-----------*/
@ -742,7 +720,29 @@
#define LV_USE_SNAPSHOT 0 #define LV_USE_SNAPSHOT 0
/*1: Enable system monitor component*/ /*1: Enable system monitor component*/
#define LV_USE_SYSMON (LV_USE_MEM_MONITOR | LV_USE_PERF_MONITOR) #define LV_USE_SYSMON 0
#if LV_USE_SYSMON
/*1: Show CPU usage and FPS count
* Requires `LV_USE_SYSMON = 1`*/
#define LV_USE_PERF_MONITOR 0
#if LV_USE_PERF_MONITOR
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
/*0: Displays performance data on the screen, 1: Prints performance data using log.*/
#define LV_USE_PERF_MONITOR_LOG_MODE 0
#endif
/*1: Show the used memory and the memory fragmentation
* Requires `LV_USE_BUILTIN_MALLOC = 1`
* Requires `LV_USE_SYSMON = 1`*/
#define LV_USE_MEM_MONITOR 0
#if LV_USE_MEM_MONITOR
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
#endif
#endif /*LV_USE_SYSMON*/
/*1: Enable the runtime performance profiler*/ /*1: Enable the runtime performance profiler*/
#define LV_USE_PROFILER 0 #define LV_USE_PROFILER 0

View File

@ -328,13 +328,11 @@ void _lv_display_refr_timer(lv_timer_t * tmr)
if(tmr) { if(tmr) {
disp_refr = tmr->user_data; disp_refr = tmr->user_data;
#if LV_USE_PERF_MONITOR == 0 && LV_USE_MEM_MONITOR == 0
/** /**
* Ensure the timer does not run again automatically. * Ensure the timer does not run again automatically.
* This is done before refreshing in case refreshing invalidates something else. * This is done before refreshing in case refreshing invalidates something else.
*/ */
lv_timer_pause(tmr); lv_timer_pause(tmr);
#endif
} }
else { else {
disp_refr = lv_display_get_default(); disp_refr = lv_display_get_default();

View File

@ -737,58 +737,6 @@
#endif #endif
#endif #endif
/*------------------
* STATUS MONITORING
*------------------*/
/*1: Show CPU usage and FPS count
* Requires `LV_USE_SYSMON = 1`*/
#ifndef LV_USE_PERF_MONITOR
#ifdef CONFIG_LV_USE_PERF_MONITOR
#define LV_USE_PERF_MONITOR CONFIG_LV_USE_PERF_MONITOR
#else
#define LV_USE_PERF_MONITOR 0
#endif
#endif
#if LV_USE_PERF_MONITOR
#ifndef LV_USE_PERF_MONITOR_POS
#ifdef CONFIG_LV_USE_PERF_MONITOR_POS
#define LV_USE_PERF_MONITOR_POS CONFIG_LV_USE_PERF_MONITOR_POS
#else
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
#endif
#endif
/*0: Displays performance data on the screen, 1: Prints performance data using log.*/
#ifndef LV_USE_PERF_MONITOR_LOG_MODE
#ifdef CONFIG_LV_USE_PERF_MONITOR_LOG_MODE
#define LV_USE_PERF_MONITOR_LOG_MODE CONFIG_LV_USE_PERF_MONITOR_LOG_MODE
#else
#define LV_USE_PERF_MONITOR_LOG_MODE 0
#endif
#endif
#endif
/*1: Show the used memory and the memory fragmentation
* Requires `LV_USE_BUILTIN_MALLOC = 1`
* Requires `LV_USE_SYSMON = 1`*/
#ifndef LV_USE_MEM_MONITOR
#ifdef CONFIG_LV_USE_MEM_MONITOR
#define LV_USE_MEM_MONITOR CONFIG_LV_USE_MEM_MONITOR
#else
#define LV_USE_MEM_MONITOR 0
#endif
#endif
#if LV_USE_MEM_MONITOR
#ifndef LV_USE_MEM_MONITOR_POS
#ifdef CONFIG_LV_USE_MEM_MONITOR_POS
#define LV_USE_MEM_MONITOR_POS CONFIG_LV_USE_MEM_MONITOR_POS
#else
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
#endif
#endif
#endif
/*------------- /*-------------
* Others * Others
*-----------*/ *-----------*/
@ -2414,10 +2362,62 @@
#ifdef CONFIG_LV_USE_SYSMON #ifdef CONFIG_LV_USE_SYSMON
#define LV_USE_SYSMON CONFIG_LV_USE_SYSMON #define LV_USE_SYSMON CONFIG_LV_USE_SYSMON
#else #else
#define LV_USE_SYSMON (LV_USE_MEM_MONITOR | LV_USE_PERF_MONITOR) #define LV_USE_SYSMON 0
#endif #endif
#endif #endif
#if LV_USE_SYSMON
/*1: Show CPU usage and FPS count
* Requires `LV_USE_SYSMON = 1`*/
#ifndef LV_USE_PERF_MONITOR
#ifdef CONFIG_LV_USE_PERF_MONITOR
#define LV_USE_PERF_MONITOR CONFIG_LV_USE_PERF_MONITOR
#else
#define LV_USE_PERF_MONITOR 0
#endif
#endif
#if LV_USE_PERF_MONITOR
#ifndef LV_USE_PERF_MONITOR_POS
#ifdef CONFIG_LV_USE_PERF_MONITOR_POS
#define LV_USE_PERF_MONITOR_POS CONFIG_LV_USE_PERF_MONITOR_POS
#else
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
#endif
#endif
/*0: Displays performance data on the screen, 1: Prints performance data using log.*/
#ifndef LV_USE_PERF_MONITOR_LOG_MODE
#ifdef CONFIG_LV_USE_PERF_MONITOR_LOG_MODE
#define LV_USE_PERF_MONITOR_LOG_MODE CONFIG_LV_USE_PERF_MONITOR_LOG_MODE
#else
#define LV_USE_PERF_MONITOR_LOG_MODE 0
#endif
#endif
#endif
/*1: Show the used memory and the memory fragmentation
* Requires `LV_USE_BUILTIN_MALLOC = 1`
* Requires `LV_USE_SYSMON = 1`*/
#ifndef LV_USE_MEM_MONITOR
#ifdef CONFIG_LV_USE_MEM_MONITOR
#define LV_USE_MEM_MONITOR CONFIG_LV_USE_MEM_MONITOR
#else
#define LV_USE_MEM_MONITOR 0
#endif
#endif
#if LV_USE_MEM_MONITOR
#ifndef LV_USE_MEM_MONITOR_POS
#ifdef CONFIG_LV_USE_MEM_MONITOR_POS
#define LV_USE_MEM_MONITOR_POS CONFIG_LV_USE_MEM_MONITOR_POS
#else
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
#endif
#endif
#endif
#endif /*LV_USE_SYSMON*/
/*1: Enable the runtime performance profiler*/ /*1: Enable the runtime performance profiler*/
#ifndef LV_USE_PROFILER #ifndef LV_USE_PROFILER
#ifdef CONFIG_LV_USE_PROFILER #ifdef CONFIG_LV_USE_PROFILER

View File

@ -23,12 +23,18 @@
#define SYSMON_REFR_PERIOD_DEF 300 /* ms */ #define SYSMON_REFR_PERIOD_DEF 300 /* ms */
#if LV_USE_PERF_MONITOR #if defined(LV_USE_PERF_MONITOR) && LV_USE_PERF_MONITOR
#define sysmon_perf LV_GLOBAL_DEFAULT()->sysmon_perf #define sysmon_perf LV_GLOBAL_DEFAULT()->sysmon_perf
#define _USE_PERF_MONITOR 1
#else
#define _USE_PERF_MONITOR 0
#endif #endif
#if LV_USE_MEM_MONITOR #if defined(LV_USE_MEM_MONITOR) && LV_USE_MEM_MONITOR
#define sysmon_mem LV_GLOBAL_DEFAULT()->sysmon_mem #define sysmon_mem LV_GLOBAL_DEFAULT()->sysmon_mem
#define _USE_MEM_MONITOR 1
#else
#define _USE_MEM_MONITOR 0
#endif #endif
/********************** /**********************
@ -41,12 +47,12 @@
static void sysmon_backend_init_async_cb(void * user_data); static void sysmon_backend_init_async_cb(void * user_data);
#if LV_USE_PERF_MONITOR #if _USE_PERF_MONITOR
static void perf_update_timer_cb(lv_timer_t * t); 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);
#endif #endif
#if LV_USE_MEM_MONITOR #if _USE_MEM_MONITOR
static void mem_update_timer_cb(lv_timer_t * t); static void mem_update_timer_cb(lv_timer_t * t);
static void mem_observer_cb(lv_observer_t * observer, lv_subject_t * subject); static void mem_observer_cb(lv_observer_t * observer, lv_subject_t * subject);
#endif #endif
@ -65,13 +71,13 @@ static void sysmon_backend_init_async_cb(void * user_data);
void _lv_sysmon_builtin_init(void) void _lv_sysmon_builtin_init(void)
{ {
#if LV_USE_PERF_MONITOR #if _USE_PERF_MONITOR
static lv_sysmon_perf_info_t perf_info; static lv_sysmon_perf_info_t perf_info;
lv_subject_init_pointer(&sysmon_perf.subject, &perf_info); lv_subject_init_pointer(&sysmon_perf.subject, &perf_info);
sysmon_perf.timer = lv_timer_create(perf_update_timer_cb, SYSMON_REFR_PERIOD_DEF, &perf_info); sysmon_perf.timer = lv_timer_create(perf_update_timer_cb, SYSMON_REFR_PERIOD_DEF, &perf_info);
#endif #endif
#if LV_USE_MEM_MONITOR #if _USE_MEM_MONITOR
static lv_mem_monitor_t mem_info; static lv_mem_monitor_t mem_info;
lv_subject_init_pointer(&sysmon_mem.subject, &mem_info); lv_subject_init_pointer(&sysmon_mem.subject, &mem_info);
sysmon_mem.timer = lv_timer_create(mem_update_timer_cb, SYSMON_REFR_PERIOD_DEF, &mem_info); sysmon_mem.timer = lv_timer_create(mem_update_timer_cb, SYSMON_REFR_PERIOD_DEF, &mem_info);
@ -83,7 +89,7 @@ void _lv_sysmon_builtin_init(void)
void _lv_sysmon_builtin_deinit(void) void _lv_sysmon_builtin_deinit(void)
{ {
lv_async_call_cancel(sysmon_backend_init_async_cb, NULL); lv_async_call_cancel(sysmon_backend_init_async_cb, NULL);
#if LV_USE_PERF_MONITOR #if _USE_PERF_MONITOR
lv_timer_delete(sysmon_perf.timer); lv_timer_delete(sysmon_perf.timer);
#endif #endif
} }
@ -104,7 +110,7 @@ lv_obj_t * lv_sysmon_create(lv_obj_t * parent)
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
#if LV_USE_PERF_MONITOR #if _USE_PERF_MONITOR
static void perf_monitor_disp_event_cb(lv_event_t * e) static void perf_monitor_disp_event_cb(lv_event_t * e)
{ {
@ -199,7 +205,7 @@ static void perf_observer_cb(lv_observer_t * observer, lv_subject_t * subject)
#endif #endif
#if LV_USE_MEM_MONITOR #if _USE_MEM_MONITOR
static void mem_update_timer_cb(lv_timer_t * t) static void mem_update_timer_cb(lv_timer_t * t)
{ {
@ -229,7 +235,7 @@ static void sysmon_backend_init_async_cb(void * user_data)
{ {
LV_UNUSED(user_data); LV_UNUSED(user_data);
#if LV_USE_PERF_MONITOR #if _USE_PERF_MONITOR
lv_display_add_event_cb(lv_display_get_default(), perf_monitor_disp_event_cb, LV_EVENT_ALL, NULL); lv_display_add_event_cb(lv_display_get_default(), perf_monitor_disp_event_cb, LV_EVENT_ALL, NULL);
lv_obj_t * obj1 = lv_sysmon_create(lv_layer_sys()); lv_obj_t * obj1 = lv_sysmon_create(lv_layer_sys());
@ -241,7 +247,7 @@ static void sysmon_backend_init_async_cb(void * user_data)
#endif #endif
#if LV_USE_MEM_MONITOR #if _USE_MEM_MONITOR
lv_obj_t * obj2 = lv_sysmon_create(lv_layer_sys()); lv_obj_t * obj2 = lv_sysmon_create(lv_layer_sys());
lv_obj_align(obj2, LV_USE_MEM_MONITOR_POS, 0, 0); lv_obj_align(obj2, LV_USE_MEM_MONITOR_POS, 0, 0);
lv_subject_add_observer_obj(&sysmon_mem.subject, mem_observer_cb, obj2, NULL); lv_subject_add_observer_obj(&sysmon_mem.subject, mem_observer_cb, obj2, NULL);

View File

@ -101,12 +101,6 @@ void _lv_sysmon_builtin_deinit(void);
* MACROS * MACROS
**********************/ **********************/
#else
#if LV_USE_PERF_MONITOR || LV_USE_MEM_MONITOR
#warning "lv_sysmon: lv_sysmon is required. Enable it in lv_conf.h (LV_USE_SYSMON 1)"
#endif
#endif /*LV_USE_SYSMON*/ #endif /*LV_USE_SYSMON*/
#ifdef __cplusplus #ifdef __cplusplus