From 8c5040ab5c4825f59bba9071a476638e7421d33f Mon Sep 17 00:00:00 2001 From: Dyyt587 <805207319@qq.com> Date: Fri, 10 May 2024 16:21:12 +0800 Subject: [PATCH] up data --- .../stm32f427-robomaster-a/project.uvoptx | 132 +- .../stm32f427-robomaster-a/project.uvprojx | 1201 ++++++++++++++--- components/utilities/cpuusage/cpuusage.c | 41 + components/utilities/cpuusage/cpuusage.h | 25 + src/scheduler_mp.c | 27 +- 5 files changed, 1181 insertions(+), 245 deletions(-) create mode 100644 components/utilities/cpuusage/cpuusage.c create mode 100644 components/utilities/cpuusage/cpuusage.h diff --git a/bsp/stm32/stm32f427-robomaster-a/project.uvoptx b/bsp/stm32/stm32f427-robomaster-a/project.uvoptx index 34c91d7f18..dd269a361e 100644 --- a/bsp/stm32/stm32f427-robomaster-a/project.uvoptx +++ b/bsp/stm32/stm32f427-robomaster-a/project.uvoptx @@ -347,18 +347,6 @@ 0 0 0 - ..\..\..\components\drivers\ipc\condvar.c - condvar.c - 0 - 0 - - - 3 - 13 - 1 - 0 - 0 - 0 ..\..\..\components\drivers\ipc\dataqueue.c dataqueue.c 0 @@ -366,7 +354,7 @@ 3 - 14 + 13 1 0 0 @@ -378,7 +366,7 @@ 3 - 15 + 14 1 0 0 @@ -390,7 +378,7 @@ 3 - 16 + 15 1 0 0 @@ -402,7 +390,7 @@ 3 - 17 + 16 1 0 0 @@ -414,7 +402,7 @@ 3 - 18 + 17 1 0 0 @@ -426,7 +414,7 @@ 3 - 19 + 18 1 0 0 @@ -438,7 +426,7 @@ 3 - 20 + 19 1 0 0 @@ -458,7 +446,7 @@ 0 4 - 21 + 20 1 0 0 @@ -470,7 +458,7 @@ 4 - 22 + 21 1 0 0 @@ -482,7 +470,7 @@ 4 - 23 + 22 1 0 0 @@ -494,7 +482,7 @@ 4 - 24 + 23 2 0 0 @@ -506,7 +494,7 @@ 4 - 25 + 24 1 0 0 @@ -518,7 +506,7 @@ 4 - 26 + 25 1 0 0 @@ -538,7 +526,7 @@ 0 5 - 27 + 26 1 0 0 @@ -550,7 +538,7 @@ 5 - 28 + 27 1 0 0 @@ -562,7 +550,7 @@ 5 - 29 + 28 1 0 0 @@ -574,7 +562,7 @@ 5 - 30 + 29 1 0 0 @@ -594,7 +582,7 @@ 0 6 - 31 + 30 1 0 0 @@ -606,7 +594,7 @@ 6 - 32 + 31 1 0 0 @@ -618,19 +606,7 @@ 6 - 33 - 1 - 0 - 0 - 0 - ..\..\..\src\cpu_up.c - cpu_up.c - 0 - 0 - - - 6 - 34 + 32 1 0 0 @@ -642,7 +618,7 @@ 6 - 35 + 33 1 0 0 @@ -654,7 +630,7 @@ 6 - 36 + 34 1 0 0 @@ -666,7 +642,7 @@ 6 - 37 + 35 1 0 0 @@ -678,7 +654,7 @@ 6 - 38 + 36 1 0 0 @@ -690,7 +666,7 @@ 6 - 39 + 37 1 0 0 @@ -702,7 +678,7 @@ 6 - 40 + 38 1 0 0 @@ -714,7 +690,7 @@ 6 - 41 + 39 1 0 0 @@ -726,7 +702,7 @@ 6 - 42 + 40 1 0 0 @@ -738,7 +714,7 @@ 6 - 43 + 41 1 0 0 @@ -750,7 +726,7 @@ 6 - 44 + 42 1 0 0 @@ -762,7 +738,7 @@ 6 - 45 + 43 1 0 0 @@ -774,7 +750,7 @@ 6 - 46 + 44 1 0 0 @@ -794,7 +770,7 @@ 0 7 - 47 + 45 1 0 0 @@ -806,7 +782,7 @@ 7 - 48 + 46 1 0 0 @@ -818,7 +794,7 @@ 7 - 49 + 47 1 0 0 @@ -830,7 +806,7 @@ 7 - 50 + 48 2 0 0 @@ -842,7 +818,7 @@ 7 - 51 + 49 1 0 0 @@ -862,7 +838,7 @@ 0 8 - 52 + 50 1 0 0 @@ -874,7 +850,7 @@ 8 - 53 + 51 1 0 0 @@ -886,7 +862,7 @@ 8 - 54 + 52 1 0 0 @@ -898,7 +874,7 @@ 8 - 55 + 53 1 0 0 @@ -910,7 +886,7 @@ 8 - 56 + 54 1 0 0 @@ -922,7 +898,7 @@ 8 - 57 + 55 1 0 0 @@ -934,7 +910,7 @@ 8 - 58 + 56 1 0 0 @@ -946,7 +922,7 @@ 8 - 59 + 57 1 0 0 @@ -958,7 +934,7 @@ 8 - 60 + 58 1 0 0 @@ -970,7 +946,7 @@ 8 - 61 + 59 1 0 0 @@ -982,7 +958,7 @@ 8 - 62 + 60 1 0 0 @@ -994,7 +970,7 @@ 8 - 63 + 61 1 0 0 @@ -1006,7 +982,7 @@ 8 - 64 + 62 1 0 0 @@ -1018,7 +994,7 @@ 8 - 65 + 63 1 0 0 @@ -1030,7 +1006,7 @@ 8 - 66 + 64 1 0 0 @@ -1042,7 +1018,7 @@ 8 - 67 + 65 1 0 0 @@ -1054,7 +1030,7 @@ 8 - 68 + 66 1 0 0 diff --git a/bsp/stm32/stm32f427-robomaster-a/project.uvprojx b/bsp/stm32/stm32f427-robomaster-a/project.uvprojx index 9be0b4dfed..98fead4102 100644 --- a/bsp/stm32/stm32f427-robomaster-a/project.uvprojx +++ b/bsp/stm32/stm32f427-robomaster-a/project.uvprojx @@ -1,42 +1,46 @@ + 2.1 +
### uVision Project, (C) Keil Software
+ rt-thread 0x4 ARM-ADS 5060750::V5.06 update 6 (build 750)::ARMCC + 0 STM32F427IIHx STMicroelectronics - Keil.STM32F4xx_DFP.2.13.0 - http://www.keil.com/pack + Keil.STM32F4xx_DFP.2.17.1 + https://www.keil.com/pack/ IRAM(0x20000000,0x00030000) IRAM2(0x10000000,0x00010000) IROM(0x08000000,0x00200000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE - - + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_2048 -FS08000000 -FL0200000 -FP0($$Device:STM32F427IIHx$CMSIS\Flash\STM32F4xx_2048.FLM)) 0 $$Device:STM32F427IIHx$Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h - - - - - - - - - + + + + + + + + + $$Device:STM32F427IIHx$CMSIS\SVD\STM32F427x.svd 0 0 - - - - - + + + + + 0 0 @@ -58,8 +62,8 @@ 0 0 - - + + 0 0 0 @@ -68,8 +72,8 @@ 0 0 - - + + 0 0 0 @@ -79,14 +83,14 @@ 1 0 fromelf --bin !L --output rtthread.bin - + 0 0 0 0 0 - + 0 @@ -100,8 +104,8 @@ 0 0 3 - - + + 1 @@ -134,11 +138,11 @@ 1 BIN\UL2CM3.DLL - - - - - + + + + + 0 @@ -171,7 +175,7 @@ 0 0 "Cortex-M4" - + 0 0 0 @@ -180,6 +184,9 @@ 0 0 2 + 0 + 0 + 0 1 0 8 @@ -303,7 +310,7 @@ 0x10000 - + 1 @@ -320,6 +327,7 @@ 0 0 1 + 0 0 1 1 @@ -329,9 +337,9 @@ 0 0 - + __STDC_LIMIT_MACROS, RT_USING_ARMLIBC, USE_HAL_DRIVER, RT_USING_LIBC, __CLK_TCK=RT_TICK_PER_SECOND, STM32F427xx, __RTTHREAD__ - + ..\..\..\libcpu\arm\cortex-m4;..\..\..\components\libc\compilers\common\extension\fcntl\octal;board;..\libraries\HAL_Drivers\CMSIS\Include;..\libraries\STM32F4xx_HAL\CMSIS\Device\ST\STM32F4xx\Include;..\..\..\components\libc\compilers\common\include;..\libraries\HAL_Drivers\drivers;applications;..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Inc;..\libraries\HAL_Drivers\drivers\config;..\..\..\components\finsh;.;..\..\..\components\libc\posix\io\epoll;..\..\..\libcpu\arm\common;..\libraries\HAL_Drivers;..\..\..\components\drivers\include;..\..\..\include;..\..\..\components\libc\posix\io\eventfd;..\..\..\components\libc\posix\io\poll;..\..\..\components\drivers\include;board\ports;..\..\..\components\libc\compilers\common\extension;..\..\..\components\drivers\include;..\..\..\components\drivers\include;board\CubeMX_Config\Inc;..\..\..\components\libc\posix\ipc @@ -345,12 +353,12 @@ 0 0 0 - 0 + 4 - - - - + + + + @@ -362,13 +370,13 @@ 0 0x08000000 0x20000000 - + .\board\linker_scripts\link.sct - - - - - + + + + + @@ -391,50 +399,36 @@ 1 ..\..\..\components\libc\compilers\armlibc\syscall_mem.c
- - syscalls.c 1 ..\..\..\components\libc\compilers\armlibc\syscalls.c - - cctype.c 1 ..\..\..\components\libc\compilers\common\cctype.c - - cstdlib.c 1 ..\..\..\components\libc\compilers\common\cstdlib.c - - cstring.c 1 ..\..\..\components\libc\compilers\common\cstring.c - - ctime.c 1 ..\..\..\components\libc\compilers\common\ctime.c - - cunistd.c 1 ..\..\..\components\libc\compilers\common\cunistd.c - - cwchar.c 1 @@ -450,8 +444,47 @@ 1 ..\..\..\components\drivers\core\device.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_IPC_SOURCE__ @@ -462,15 +495,52 @@ - - completion.c 1 ..\..\..\components\drivers\ipc\completion.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_IPC_SOURCE__ @@ -481,15 +551,52 @@ - - dataqueue.c 1 ..\..\..\components\drivers\ipc\dataqueue.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_IPC_SOURCE__ @@ -500,15 +607,52 @@ - - pipe.c 1 ..\..\..\components\drivers\ipc\pipe.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_IPC_SOURCE__ @@ -519,15 +663,52 @@ - - ringblk_buf.c 1 ..\..\..\components\drivers\ipc\ringblk_buf.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_IPC_SOURCE__ @@ -538,15 +719,52 @@ - - ringbuffer.c 1 ..\..\..\components\drivers\ipc\ringbuffer.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_IPC_SOURCE__ @@ -557,15 +775,52 @@ - - waitqueue.c 1 ..\..\..\components\drivers\ipc\waitqueue.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_IPC_SOURCE__ @@ -576,15 +831,52 @@ - - workqueue.c 1 ..\..\..\components\drivers\ipc\workqueue.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_IPC_SOURCE__ @@ -595,15 +887,52 @@ - - pin.c 1 ..\..\..\components\drivers\pin\pin.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_IPC_SOURCE__ @@ -614,15 +943,52 @@ - - serial.c 1 ..\..\..\components\drivers\serial\serial.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_IPC_SOURCE__ @@ -643,36 +1009,26 @@ 1 ..\libraries\HAL_Drivers\drivers\drv_gpio.c - - drv_usart.c 1 ..\libraries\HAL_Drivers\drivers\drv_usart.c - - drv_common.c 1 ..\libraries\HAL_Drivers\drv_common.c - - startup_stm32f427xx.s 2 ..\libraries\STM32F4xx_HAL\CMSIS\Device\ST\STM32F4xx\Source\Templates\arm\startup_stm32f427xx.s - - stm32f4xx_hal_msp.c 1 board\CubeMX_Config\Src\stm32f4xx_hal_msp.c - - board.c 1 @@ -688,22 +1044,16 @@ 1 ..\..\..\components\finsh\shell.c - - msh.c 1 ..\..\..\components\finsh\msh.c - - msh_parse.c 1 ..\..\..\components\finsh\msh_parse.c - - cmd.c 1 @@ -719,8 +1069,47 @@ 1 ..\..\..\src\clock.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -731,15 +1120,52 @@ - - components.c 1 ..\..\..\src\components.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -750,15 +1176,52 @@ - - idle.c 1 ..\..\..\src\idle.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -769,15 +1232,52 @@ - - ipc.c 1 ..\..\..\src\ipc.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -788,15 +1288,52 @@ - - irq.c 1 ..\..\..\src\irq.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -807,15 +1344,52 @@ - - kstdio.c 1 ..\..\..\src\klibc\kstdio.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -826,15 +1400,52 @@ - - kstring.c 1 ..\..\..\src\klibc\kstring.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -845,15 +1456,52 @@ - - kservice.c 1 ..\..\..\src\kservice.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -864,15 +1512,52 @@ - - mem.c 1 ..\..\..\src\mem.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -883,15 +1568,52 @@ - - mempool.c 1 ..\..\..\src\mempool.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -902,15 +1624,52 @@ - - object.c 1 ..\..\..\src\object.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -921,15 +1680,52 @@ - - scheduler_comm.c 1 ..\..\..\src\scheduler_comm.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -940,34 +1736,108 @@ - - scheduler_up.c 1 ..\..\..\src\scheduler_up.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ - + - - thread.c 1 ..\..\..\src\thread.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -978,15 +1848,52 @@ - - timer.c 1 ..\..\..\src\timer.c + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 __RT_KERNEL_SOURCE__ @@ -1007,29 +1914,21 @@ 1 ..\..\..\libcpu\arm\common\atomic_arm.c - - div0.c 1 ..\..\..\libcpu\arm\common\div0.c - - showmem.c 1 ..\..\..\libcpu\arm\common\showmem.c - - context_rvds.S 2 ..\..\..\libcpu\arm\cortex-m4\context_rvds.S - - cpuport.c 1 @@ -1045,113 +1944,81 @@ 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c - - stm32f4xx_hal_cryp_ex.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cryp_ex.c - - stm32f4xx_hal_pwr_ex.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c - - stm32f4xx_hal_rng.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c - - stm32f4xx_hal_dma.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c - - stm32f4xx_hal.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c - - stm32f4xx_hal_rcc_ex.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c - - stm32f4xx_hal_usart.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_usart.c - - stm32f4xx_hal_cec.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cec.c - - stm32f4xx_hal_rcc.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c - - stm32f4xx_hal_dma_ex.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c - - stm32f4xx_hal_pwr.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c - - system_stm32f4xx.c 1 ..\libraries\STM32F4xx_HAL\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c - - stm32f4xx_hal_crc.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c - - stm32f4xx_hal_cortex.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c - - stm32f4xx_hal_cryp.c 1 ..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cryp.c - - stm32f4xx_hal_gpio.c 1 @@ -1162,9 +2029,11 @@ + - - - + + + + diff --git a/components/utilities/cpuusage/cpuusage.c b/components/utilities/cpuusage/cpuusage.c new file mode 100644 index 0000000000..5622e891d3 --- /dev/null +++ b/components/utilities/cpuusage/cpuusage.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024-2024, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-05-9 Dyyt587 the first version + */ + +#include "cpuusage.h" +//#ifdef RT_USING_CPU_USAGE +#if 1 +static rt_tick_t pause_tick = 0; + +/** + * @brief pause usage measure + * + * @note reduce scheduler time consuming + */ +void rt_usage_measure_pause(void) +{ + pause_tick = rt_tick_get(); +} +/** + * @brief start usage measure + * + * @param from wait to turn on + * @param to turn to be + */ +void rt_usage_measure_start(struct rt_thread *from, struct rt_thread *to) +{ + /* to avoid scheduler time consuming */ + from->duration_tick += pause_tick - from->last_start_tick; + + to->last_start_tick = rt_tick_get(); +} + + + +#endif /* RT_USING_CPU_USAGE */ \ No newline at end of file diff --git a/components/utilities/cpuusage/cpuusage.h b/components/utilities/cpuusage/cpuusage.h new file mode 100644 index 0000000000..d796a5d340 --- /dev/null +++ b/components/utilities/cpuusage/cpuusage.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2024-2024, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-05-9 Dyyt587 the first version + */ + +#ifndef CPU_USAGE_H +#define CPU_USAGE_H + +#include +#include "ulog_def.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/scheduler_mp.c b/src/scheduler_mp.c index ee32d9bc60..60308312ef 100644 --- a/src/scheduler_mp.c +++ b/src/scheduler_mp.c @@ -137,6 +137,30 @@ static void (*rt_scheduler_switch_hook)(struct rt_thread *tid); /**@{*/ +/** + * @brief pause usage measure + */ +#ifdef RT_USING_CPU_USAGE +rt_weak +#endif /* RT_USING_CPU_USAGE */ +void rt_usage_measure_pause(void) +{ + /* do nothing in it, implemented in another file */ +} +/** + * @brief start usage measure + * + * @param from wait to turn on + * @param to turn to be + */ +#ifdef RT_USING_CPU_USAGE +rt_weak +#endif /* RT_USING_CPU_USAGE */ +void rt_usage_measure_start(struct rt_thread *from, struct rt_thread *to) +{ + /* do nothing in it, implemented in another file */ +} + /** * @brief This function will set a hook function, which will be invoked when thread * switch happens. @@ -857,7 +881,8 @@ void rt_schedule(void) cpu_id, RT_SCHED_PRIV(to_thread).current_priority, RT_NAME_MAX, to_thread->parent.name, to_thread->sp, RT_NAME_MAX, current_thread->parent.name, current_thread->sp); - + rt_usage_measure_pause(); + rt_usage_measure_start(current_thread,to_thread); rt_hw_context_switch((rt_ubase_t)¤t_thread->sp, (rt_ubase_t)&to_thread->sp, to_thread); }