mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
feat(sysmon): add option to use custom idle function (#5421)
This commit is contained in:
parent
2e90e65383
commit
1771cf0b38
@ -725,8 +725,9 @@
|
||||
|
||||
/*1: Enable system monitor component*/
|
||||
#define LV_USE_SYSMON 0
|
||||
|
||||
#if LV_USE_SYSMON
|
||||
/*Get the idle percentage. E.g. uint32_t my_get_idle(void);*/
|
||||
#define LV_SYSMON_GET_IDLE lv_timer_get_idle
|
||||
|
||||
/*1: Show CPU usage and FPS count
|
||||
* Requires `LV_USE_SYSMON = 1`*/
|
||||
|
@ -2375,8 +2375,15 @@
|
||||
#define LV_USE_SYSMON 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LV_USE_SYSMON
|
||||
/*Get the idle percentage. E.g. uint32_t my_get_idle(void);*/
|
||||
#ifndef LV_SYSMON_GET_IDLE
|
||||
#ifdef CONFIG_LV_SYSMON_GET_IDLE
|
||||
#define LV_SYSMON_GET_IDLE CONFIG_LV_SYSMON_GET_IDLE
|
||||
#else
|
||||
#define LV_SYSMON_GET_IDLE lv_timer_get_idle
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*1: Show CPU usage and FPS count
|
||||
* Requires `LV_USE_SYSMON = 1`*/
|
||||
|
@ -258,7 +258,7 @@ void _lv_timer_core_deinit(void)
|
||||
_lv_ll_clear(timer_ll_p);
|
||||
}
|
||||
|
||||
uint8_t lv_timer_get_idle(void)
|
||||
uint32_t lv_timer_get_idle(void)
|
||||
{
|
||||
return state.idle_last;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ void lv_timer_enable(bool en);
|
||||
* Get idle percentage
|
||||
* @return the lv_timer idle in percentage
|
||||
*/
|
||||
uint8_t lv_timer_get_idle(void);
|
||||
uint32_t lv_timer_get_idle(void);
|
||||
|
||||
/**
|
||||
* Get the time remaining until the next timer will run
|
||||
|
@ -144,15 +144,18 @@ static void perf_monitor_disp_event_cb(lv_event_t * e)
|
||||
break;
|
||||
}
|
||||
}
|
||||
uint32_t lv_os_get_idle_percent(void);
|
||||
|
||||
static void perf_update_timer_cb(lv_timer_t * t)
|
||||
{
|
||||
uint32_t LV_SYSMON_GET_IDLE(void);
|
||||
|
||||
lv_sysmon_perf_info_t * info = lv_timer_get_user_data(t);
|
||||
info->calculated.run_cnt++;
|
||||
|
||||
info->calculated.fps = info->measured.refr_interval_sum ? (1000 * info->measured.refr_cnt /
|
||||
info->measured.refr_interval_sum) : 0;
|
||||
info->calculated.cpu = 100 - lv_timer_get_idle();
|
||||
info->calculated.cpu = 100 - LV_SYSMON_GET_IDLE();
|
||||
info->calculated.refr_avg_time = info->measured.refr_cnt ? (info->measured.refr_elaps_sum / info->measured.refr_cnt) :
|
||||
0;
|
||||
info->calculated.flush_avg_time = info->measured.flush_cnt ? (info->measured.flush_elaps_sum / info->measured.flush_cnt)
|
||||
|
Loading…
x
Reference in New Issue
Block a user