mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-27 03:25:28 +08:00
feat(sysmon): add API to start or stop sysmon and dump FPS info (#8533)
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Signed-off-by: wangxuedong <wangxuedong@xiaomi.com> Signed-off-by: wxd <xaowang96@gmail.com>
This commit is contained in:
@@ -18,5 +18,6 @@ Auxiliary Modules
|
||||
obj_property
|
||||
observer/index
|
||||
snapshot
|
||||
sysmon
|
||||
test
|
||||
translation
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
.. _sysmon:
|
||||
|
||||
=======================
|
||||
System Monitor (sysmon)
|
||||
=======================
|
||||
|
||||
The System Monitor module provides real-time monitoring of system performance
|
||||
metrics directly on your display. It supports both performance monitoring
|
||||
(CPU usage and FPS) and memory monitoring (used memory and fragmentation).
|
||||
|
||||
Dependencies
|
||||
************
|
||||
- Requires ``LV_USE_LABEL = 1`` in lv_conf.h
|
||||
- Requires ``LV_USE_OBSERVER = 1`` in lv_conf.h
|
||||
- Requires ``LV_USE_SYSMON = 1`` in lv_conf.h
|
||||
|
||||
.. _sysmon_usage:
|
||||
|
||||
Usage
|
||||
*****
|
||||
|
||||
Configuration
|
||||
--------------
|
||||
Enable in ``lv_conf.h``:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
/* Main sysmon enable */
|
||||
#define LV_USE_SYSMON 1
|
||||
|
||||
/* Performance monitor (CPU% and FPS) */
|
||||
#define LV_USE_PERF_MONITOR 1
|
||||
|
||||
/* Memory monitor (used + fragmentation) */
|
||||
#define LV_USE_MEM_MONITOR 1
|
||||
|
||||
/* Optional: refresh period in ms */
|
||||
#define LV_SYSMON_REFR_PERIOD_DEF 300
|
||||
|
||||
/* Optional: log to console instead of screen */
|
||||
#define LV_USE_PERF_MONITOR_LOG_MODE 0
|
||||
|
||||
Creating Monitors
|
||||
-----------------
|
||||
.. code-block:: c
|
||||
|
||||
/* Create generic monitor */
|
||||
lv_obj_t * sysmon = lv_sysmon_create(lv_display_get_default());
|
||||
|
||||
/* Create performance monitor */
|
||||
lv_sysmon_show_performance(NULL); /* NULL = default display */
|
||||
|
||||
/* Create memory monitor */
|
||||
lv_sysmon_show_memory(NULL);
|
||||
|
||||
Performance Monitor
|
||||
-------------------
|
||||
Tracks:
|
||||
- FPS (Frames Per Second)
|
||||
- CPU usage (%)
|
||||
- Render time (ms)
|
||||
- Flush time (ms)
|
||||
- Self CPU usage (%) if enabled
|
||||
|
||||
Display format:
|
||||
.. code-block::
|
||||
|
||||
32 FPS, 45% CPU
|
||||
8 ms
|
||||
|
||||
Where:
|
||||
- Line 1: FPS, Total CPU%
|
||||
- Line 2: Total time (Render | Flush)
|
||||
|
||||
Pause and Resume
|
||||
****************
|
||||
|
||||
:cpp:expr:`lv_sysmon_performance_pause(disp)` pauses the perf monitor.
|
||||
|
||||
:cpp:expr:`lv_sysmon_performance_resume(disp)` resumes the perf monitor.
|
||||
|
||||
Memory Monitor
|
||||
--------------
|
||||
Displays:
|
||||
- Current memory usage (kB and %)
|
||||
- Peak memory usage (kB)
|
||||
- Fragmentation (%)
|
||||
|
||||
Display format:
|
||||
.. code-block::
|
||||
|
||||
24.8 kB (76%)
|
||||
32.4 kB max, 18% frag.
|
||||
|
||||
Positioning
|
||||
-----------
|
||||
Configure positions in lv_conf.h:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
/* Top-right corner */
|
||||
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_TOP_RIGHT
|
||||
|
||||
/* Bottom-right corner */
|
||||
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
|
||||
|
||||
|
||||
Implementation Details
|
||||
**********************
|
||||
|
||||
Initialization
|
||||
--------------
|
||||
Maintains:
|
||||
- Global memory monitor (``sysmon_mem``)
|
||||
- Per-display performance structures
|
||||
|
||||
Performance Measurement
|
||||
-----------------------
|
||||
Event-based collection:
|
||||
|
||||
+----------------------+--------------------------------+
|
||||
| Event | Measurement |
|
||||
+======================+================================+
|
||||
| LV_EVENT_REFR_START | Refresh interval start |
|
||||
+----------------------+--------------------------------+
|
||||
| LV_EVENT_REFR_READY | Record refresh duration |
|
||||
+----------------------+--------------------------------+
|
||||
| LV_EVENT_RENDER_START| Render time start |
|
||||
+----------------------+--------------------------------+
|
||||
| LV_EVENT_RENDER_READY| Record render duration |
|
||||
+----------------------+--------------------------------+
|
||||
| LV_EVENT_FLUSH_* | Measure flush operations |
|
||||
+----------------------+--------------------------------+
|
||||
|
||||
Timers
|
||||
------
|
||||
- Performance: ``perf_update_timer_cb``
|
||||
- Memory: ``mem_update_timer_cb``
|
||||
- Default period: 300ms (``LV_SYSMON_REFR_PERIOD_DEF``)
|
||||
Reference in New Issue
Block a user