fix(profiler): fixed inability to disable and add new measurement points (#4224)
Signed-off-by: FASTSHIFT <vifextech@foxmail.com> Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
2
Kconfig
2
Kconfig
@@ -1010,7 +1010,7 @@ menu "LVGL configuration"
|
|||||||
default n
|
default n
|
||||||
|
|
||||||
config LV_USE_PROFILER
|
config LV_USE_PROFILER
|
||||||
bool "Run-time performance profiler."
|
bool "Runtime performance profiler."
|
||||||
config LV_PROFILER_INCLUDE
|
config LV_PROFILER_INCLUDE
|
||||||
string "Header to include for the profiler"
|
string "Header to include for the profiler"
|
||||||
depends on LV_USE_PROFILER
|
depends on LV_USE_PROFILER
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ Porting
|
|||||||
|
|
||||||
To enable profiler, set :c:macro:`LV_USE_PROFILER` in ``lv_conf.h`` and configure the following options:
|
To enable profiler, set :c:macro:`LV_USE_PROFILER` in ``lv_conf.h`` and configure the following options:
|
||||||
|
|
||||||
- :c:macro:`LV_PROFILER_INCLUDE`: Provides a header file for the performance measurement function.
|
- :c:macro:`LV_PROFILER_INCLUDE`: Provides a header file for the profiler function.
|
||||||
- :c:macro:`LV_PROFILER_BEGIN`: Performance measurement start point function.
|
- :c:macro:`LV_PROFILER_BEGIN`: Profiler start point function.
|
||||||
- :c:macro:`LV_PROFILER_END`: Performance measurement end point function.
|
- :c:macro:`LV_PROFILER_END`: Profiler end point function.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
*******
|
*******
|
||||||
@@ -30,7 +30,7 @@ Configure ``lv_conf.h``:
|
|||||||
#define LV_USE_PROFILER 1
|
#define LV_USE_PROFILER 1
|
||||||
#define LV_PROFILER_INCLUDE "lvgl/src/hal/lv_hal_tick.h"
|
#define LV_PROFILER_INCLUDE "lvgl/src/hal/lv_hal_tick.h"
|
||||||
#define LV_PROFILER_BEGIN uint32_t profiler_start = lv_tick_get()
|
#define LV_PROFILER_BEGIN uint32_t profiler_start = lv_tick_get()
|
||||||
#define LV_PROFILER_END LV_LOG_USER("cost %" LV_PRIu32 "ms", lv_tick_elaps(profiler_start))
|
#define LV_PROFILER_END LV_LOG_USER("cost %dms", (int)lv_tick_elaps(profiler_start))
|
||||||
|
|
||||||
|
|
||||||
Users can add the measured functions themselves:
|
Users can add the measured functions themselves:
|
||||||
|
|||||||
@@ -700,11 +700,18 @@
|
|||||||
/*1: Enable system monitor component*/
|
/*1: Enable system monitor component*/
|
||||||
#define LV_USE_SYSMON 0
|
#define LV_USE_SYSMON 0
|
||||||
|
|
||||||
/*1: Enable the run-time performance profiler*/
|
/*1: Enable the runtime performance profiler*/
|
||||||
#define LV_USE_PROFILER 0
|
#define LV_USE_PROFILER 0
|
||||||
#define LV_PROFILER_INCLUDE <stdint.h>
|
#if LV_USE_PROFILER
|
||||||
#define LV_PROFILER_BEGIN
|
/*Header to include for the profiler*/
|
||||||
#define LV_PROFILER_END
|
#define LV_PROFILER_INCLUDE <stdint.h>
|
||||||
|
|
||||||
|
/*Profiler start point function*/
|
||||||
|
#define LV_PROFILER_BEGIN
|
||||||
|
|
||||||
|
/*Profiler end point function*/
|
||||||
|
#define LV_PROFILER_END
|
||||||
|
#endif
|
||||||
|
|
||||||
/*1: Enable Monkey test*/
|
/*1: Enable Monkey test*/
|
||||||
#define LV_USE_MONKEY 0
|
#define LV_USE_MONKEY 0
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "../misc/lv_timer.h"
|
#include "../misc/lv_timer.h"
|
||||||
#include "../misc/lv_math.h"
|
#include "../misc/lv_math.h"
|
||||||
#include "../misc/lv_gc.h"
|
#include "../misc/lv_gc.h"
|
||||||
|
#include "../misc/lv_profiler.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
@@ -135,6 +136,7 @@ lv_indev_t * lv_indev_get_next(lv_indev_t * indev)
|
|||||||
|
|
||||||
void _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
void _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
||||||
{
|
{
|
||||||
|
LV_PROFILER_BEGIN;
|
||||||
lv_memzero(data, sizeof(lv_indev_data_t));
|
lv_memzero(data, sizeof(lv_indev_data_t));
|
||||||
|
|
||||||
/* For touchpad sometimes users don't set the last pressed coordinate on release.
|
/* For touchpad sometimes users don't set the last pressed coordinate on release.
|
||||||
@@ -159,6 +161,7 @@ void _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
|||||||
else {
|
else {
|
||||||
LV_LOG_WARN("indev_read_cb is not registered");
|
LV_LOG_WARN("indev_read_cb is not registered");
|
||||||
}
|
}
|
||||||
|
LV_PROFILER_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_indev_read_timer_cb(lv_timer_t * timer)
|
void lv_indev_read_timer_cb(lv_timer_t * timer)
|
||||||
@@ -177,6 +180,9 @@ void lv_indev_read_timer_cb(lv_timer_t * timer)
|
|||||||
|
|
||||||
if(indev_act->disabled ||
|
if(indev_act->disabled ||
|
||||||
indev_act->disp->prev_scr != NULL) return; /*Input disabled or screen animation active*/
|
indev_act->disp->prev_scr != NULL) return; /*Input disabled or screen animation active*/
|
||||||
|
|
||||||
|
LV_PROFILER_BEGIN;
|
||||||
|
|
||||||
bool continue_reading;
|
bool continue_reading;
|
||||||
do {
|
do {
|
||||||
/*Read the data*/
|
/*Read the data*/
|
||||||
@@ -218,6 +224,7 @@ void lv_indev_read_timer_cb(lv_timer_t * timer)
|
|||||||
indev_obj_act = NULL;
|
indev_obj_act = NULL;
|
||||||
|
|
||||||
INDEV_TRACE("finished");
|
INDEV_TRACE("finished");
|
||||||
|
LV_PROFILER_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_indev_enable(lv_indev_t * indev, bool en)
|
void lv_indev_enable(lv_indev_t * indev, bool en)
|
||||||
|
|||||||
@@ -1074,6 +1074,7 @@ static void draw_buf_flush(lv_disp_t * disp)
|
|||||||
|
|
||||||
static void call_flush_cb(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_p)
|
static void call_flush_cb(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_p)
|
||||||
{
|
{
|
||||||
|
LV_PROFILER_BEGIN;
|
||||||
REFR_TRACE("Calling flush_cb on (%d;%d)(%d;%d) area with %p image pointer",
|
REFR_TRACE("Calling flush_cb on (%d;%d)(%d;%d) area with %p image pointer",
|
||||||
(int)area->x1, (int)area->y1, (int)area->x2, (int)area->y2,
|
(int)area->x1, (int)area->y1, (int)area->x2, (int)area->y2,
|
||||||
(void *)color_p);
|
(void *)color_p);
|
||||||
@@ -1088,4 +1089,5 @@ static void call_flush_cb(lv_disp_t * disp, const lv_area_t * area, lv_color_t *
|
|||||||
if(disp->draw_ctx->buffer_convert) disp->draw_ctx->buffer_convert(disp->draw_ctx);
|
if(disp->draw_ctx->buffer_convert) disp->draw_ctx->buffer_convert(disp->draw_ctx);
|
||||||
|
|
||||||
disp->flush_cb(disp, &offset_area, color_p);
|
disp->flush_cb(disp, &offset_area, color_p);
|
||||||
|
LV_PROFILER_END;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2346,7 +2346,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*1: Enable the run-time 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
|
||||||
#define LV_USE_PROFILER CONFIG_LV_USE_PROFILER
|
#define LV_USE_PROFILER CONFIG_LV_USE_PROFILER
|
||||||
@@ -2354,26 +2354,33 @@
|
|||||||
#define LV_USE_PROFILER 0
|
#define LV_USE_PROFILER 0
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_PROFILER_INCLUDE
|
#if LV_USE_PROFILER
|
||||||
|
/*Header to include for the profiler*/
|
||||||
|
#ifndef LV_PROFILER_INCLUDE
|
||||||
#ifdef CONFIG_LV_PROFILER_INCLUDE
|
#ifdef CONFIG_LV_PROFILER_INCLUDE
|
||||||
#define LV_PROFILER_INCLUDE CONFIG_LV_PROFILER_INCLUDE
|
#define LV_PROFILER_INCLUDE CONFIG_LV_PROFILER_INCLUDE
|
||||||
#else
|
#else
|
||||||
#define LV_PROFILER_INCLUDE <stdint.h>
|
#define LV_PROFILER_INCLUDE <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_PROFILER_BEGIN
|
|
||||||
|
/*Profiler start point function*/
|
||||||
|
#ifndef LV_PROFILER_BEGIN
|
||||||
#ifdef CONFIG_LV_PROFILER_BEGIN
|
#ifdef CONFIG_LV_PROFILER_BEGIN
|
||||||
#define LV_PROFILER_BEGIN CONFIG_LV_PROFILER_BEGIN
|
#define LV_PROFILER_BEGIN CONFIG_LV_PROFILER_BEGIN
|
||||||
#else
|
#else
|
||||||
#define LV_PROFILER_BEGIN
|
#define LV_PROFILER_BEGIN
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef LV_PROFILER_END
|
|
||||||
|
/*Profiler end point function*/
|
||||||
|
#ifndef LV_PROFILER_END
|
||||||
#ifdef CONFIG_LV_PROFILER_END
|
#ifdef CONFIG_LV_PROFILER_END
|
||||||
#define LV_PROFILER_END CONFIG_LV_PROFILER_END
|
#define LV_PROFILER_END CONFIG_LV_PROFILER_END
|
||||||
#else
|
#else
|
||||||
#define LV_PROFILER_END
|
#define LV_PROFILER_END
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*1: Enable Monkey test*/
|
/*1: Enable Monkey test*/
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ extern "C" {
|
|||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define LV_PROFILER_BEGIN
|
||||||
|
#define LV_PROFILER_END
|
||||||
|
|
||||||
#endif /*LV_USE_PROFILER*/
|
#endif /*LV_USE_PROFILER*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
Reference in New Issue
Block a user