How to debug the speed of flush

Description

I found a strange thing. After I modified some ui code in excuting well project. It excuted abnormal that powerup loading ui is quick and normal,but when I used some input device key to change ,it likes key changing is not accepted that keyinput changing is normal in simulation but ui has no changing . When I change a variable to const. It became normal. I have no idea about this .

What MCU/Processor/Board and compiler are you using?

STM32H7B0 within L1 cache.

What LVGL version are you using?

V8.3

What do you want to achieve?

Find why and what make it slow

What have you tried so far?

I tried change the u16* bltime to __IO(volatile) u16* bltime.
And finally used the const (10) instead of the *bltime.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

u8 PowerSave_LcdBL_Manage(__IO u16 *bltime,u32 powertime,u16 input)
{
    static u32 cnt_key_invalid = 0;
    __IO static u16 cnt_lcdbl_down = 0,cnt_powerdown = 0;
    if((Lock_Move == 0))
    {
        if((input == 0)&&(AxisCmdBit == 0))
        {
            if(cnt_lcdbl_down < 10)//*bltime) 
					cnt_lcdbl_down++;
            else
            {   
                if(*bltime)
                    Set_Lcd_Brightness(0);
                Lock_Move = 1;
            }
        }
        else
            cnt_lcdbl_down = 0;
    }
    if((Lock_Move == 1) )
    {
        Dis_Key_2_Lvgl = 1;
        if(input != 0)
        {
            Set_Lcd_Brightness(Lcd_BL_Level);        
            cnt_lcdbl_down = 0;
            Lock_Move = 2;            
        }
        if(cnt_powerdown < powertime)
            cnt_powerdown++;
        else
#if  !SELF_AXIS_TEST          
            HAL_GPIO_WritePin(Battery_Hold_GPIO_Port,Battery_Hold_Pin,GPIO_PIN_RESET);
#else
        ;
#endif        
        
        dis_key_op = 1;
    }
    else
        cnt_powerdown = 0;
    if((Lock_Move == 2) &&( input == 0))
        Lock_Move = 3;
    if((Lock_Move == 3))
    {        
        if(cnt_key_invalid < 10)
            cnt_key_invalid++;
        else
        {
            Dis_Key_2_Lvgl = 0;
            cnt_key_invalid = 0;
            Lock_Move = 0;
            dis_key_op = 0;
        }
    }
    else
        cnt_key_invalid = 0;
    
    if(Lock_Move == 3)
        input = 0;
    return Lock_Move;
}

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.