mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
feat(profiler_builtin): add enable/disable interface (#5414)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
parent
cf7ee6feba
commit
151da62a9e
@ -93,6 +93,8 @@ void lv_profiler_builtin_init(const lv_profiler_builtin_config_t * config)
|
||||
profiler_ctx.config.flush_cb("#\n");
|
||||
}
|
||||
|
||||
lv_profiler_builtin_set_enable(true);
|
||||
|
||||
LV_LOG_INFO("init OK, item_num = %d", (int)num);
|
||||
}
|
||||
|
||||
@ -103,6 +105,11 @@ void lv_profiler_builtin_uninit(void)
|
||||
lv_memzero(&profiler_ctx, sizeof(profiler_ctx));
|
||||
}
|
||||
|
||||
void lv_profiler_builtin_set_enable(bool enable)
|
||||
{
|
||||
profiler_ctx.enable = enable;
|
||||
}
|
||||
|
||||
void lv_profiler_builtin_flush(void)
|
||||
{
|
||||
LV_ASSERT_NULL(profiler_ctx.item_arr);
|
||||
@ -132,6 +139,11 @@ void lv_profiler_builtin_write(const char * func, char tag)
|
||||
{
|
||||
LV_ASSERT_NULL(profiler_ctx.item_arr);
|
||||
LV_ASSERT_NULL(func);
|
||||
|
||||
if(!profiler_ctx.enable) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(profiler_ctx.cur_index >= profiler_ctx.item_num) {
|
||||
lv_profiler_builtin_flush();
|
||||
profiler_ctx.cur_index = 0;
|
||||
|
@ -62,6 +62,7 @@ typedef struct {
|
||||
uint32_t item_num; /**< Number of profiler items in the array */
|
||||
uint32_t cur_index; /**< Index of the current profiler item */
|
||||
lv_profiler_builtin_config_t config; /**< Configuration for the built-in profiler */
|
||||
bool enable; /**< Whether the built-in profiler is enabled */
|
||||
} lv_profiler_builtin_ctx_t;
|
||||
|
||||
/**********************
|
||||
@ -85,6 +86,12 @@ void lv_profiler_builtin_init(const lv_profiler_builtin_config_t * config);
|
||||
*/
|
||||
void lv_profiler_builtin_uninit(void);
|
||||
|
||||
/**
|
||||
* @brief Enable or disable the built-in profiler
|
||||
* @param enable true to enable the built-in profiler, false to disable
|
||||
*/
|
||||
void lv_profiler_builtin_set_enable(bool enable);
|
||||
|
||||
/**
|
||||
* @brief Flush the profiling data to the console
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user