From 8559f0983e9cf4f137dc187fa335a7bed3e763ff Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Sat, 22 Jun 2024 16:30:03 +0800 Subject: [PATCH] =?utf8?q?=E6=B7=BB=E5=8A=A0=20=E4=BB=BB=E5=8A=A1=E8=B0=83?= =?utf8?q?=E8=AF=95=E6=89=93=E5=8D=B0AT=E6=8C=87=E4=BB=A4=EF=BC=8C?= =?utf8?q?=E5=9C=A8=E7=9D=A1=E7=9C=A0=E7=8A=B6=E6=80=81=E6=89=93=E5=8D=B0?= =?utf8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=86=85=E5=AD=98=E7=8A=B6=E6=80=81?= =?utf8?q?=E6=89=93=E5=8D=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../brandy/brandy_standard/thread_init.c | 3 +- .../peripheral/utils/custom_utils_at_cmd.c | 35 +++++++++++++++++++ .../peripheral/utilscpp/CMakeLists.txt | 3 ++ .../peripheral/utilscpp/custom_utilscpp.cpp | 6 ++++ .../peripheral/utilscpp/custom_utilscpp.h | 1 + .../kernel/base/sched/sched_sq/los_sched.c | 10 +++++- .../src/utils/frameworks/mem_check.cpp | 2 +- 7 files changed, 57 insertions(+), 3 deletions(-) diff --git a/code/sdk/application/brandy/brandy_standard/thread_init.c b/code/sdk/application/brandy/brandy_standard/thread_init.c index d3868bd55..ca5eaea39 100755 --- a/code/sdk/application/brandy/brandy_standard/thread_init.c +++ b/code/sdk/application/brandy/brandy_standard/thread_init.c @@ -305,7 +305,7 @@ void system_time_cali(void) } return; } - +#include "custom_utils.h" static void app_main(const void *unused) { unused(unused); @@ -331,6 +331,7 @@ static void app_main(const void *unused) #ifndef XTS_SUPPORT PRINT("app_main run start."NEWLINE); print_system_sleep_info(); + uapi_dump_meminfo(); oml_pf_log_print0(LOG_BCORE_PLT_DRIVER_REBOOT, LOG_NUM_DRIVER_LPC, LOG_LEVEL_INFO, "App run ok."); #endif } diff --git a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c index 1f7271e66..01f3818cc 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c @@ -655,8 +655,41 @@ static uint32_t custom_uapi_efuse_test_read(uint8_t *para, uint32_t paraLen, cha return ERRCODE_SUCC; } +extern void los_sched_debug_enable(uint8_t enable); +static uint32_t custom_task_sched_debug(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + + UNUSED(strCommonCmd); + + uint8_t argv[CUSTOM_UTILS_MAX_ARGC][CUSTOM_UTILS_MAX_ARGV_LEN] = { 0 }; + uint32_t argc = 0; + + int ret = ConvertCmdToParam(para, paraLen, argv, &argc); + if (ret != CUSTOM_UTILS_SUCCESS) { + PRINT("CUSTOM_UTILSTEST ATCMD Convert Command Failed\n"); + return ERRCODE_FAIL; + } + + if (argc != 1) { + PRINT("CUSTOM_UTILSTEST power_test ATCMD Set Parameter Failed argc %d\r\n"); + return ERRCODE_FAIL; + } + uint32_t enable = atol((char*)argv[0]); + + los_sched_debug_enable(enable); + return ERRCODE_SUCC; +} +static uint32_t custom_mem_debug(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + + UNUSED(strCommonCmd); + + uapi_dump_meminfo(); + + return ERRCODE_SUCC; +} static const at_cmd_table_t g_custom_utils_cmd[] = { { (char *)"AT^CUSTOM_SN", custom_utils_setsn, (char *)"123456789ABCDEF2345678" }, { (char *)"AT^CUSTOM_SN_REQ", custom_utils_getsn, (char *)" " }, @@ -705,6 +738,8 @@ static const at_cmd_table_t g_custom_utils_cmd[] = { { (char *)"AT^EFUSEREAD", custom_uapi_efuse_test_read, (char *)" " }, { (char *)"AT^EFUSEWRITE", custom_uapi_efuse_test_write, (char *)" " }, + { (char *)"AT^SCHEDDEBUG", custom_task_sched_debug, (char *)" " }, + { (char *)"AT^MEMDEBUG", custom_mem_debug, (char *)" " }, }; diff --git a/code/sdk/drivers/peripheral/utilscpp/CMakeLists.txt b/code/sdk/drivers/peripheral/utilscpp/CMakeLists.txt index eb794f8a5..99caae410 100644 --- a/code/sdk/drivers/peripheral/utilscpp/CMakeLists.txt +++ b/code/sdk/drivers/peripheral/utilscpp/CMakeLists.txt @@ -16,6 +16,9 @@ set(PUBLIC_HEADER set(PRIVATE_HEADER ${CMAKE_SOURCE_DIR}/middleware/utils/update/inner_include + ${CMAKE_SOURCE_DIR}/middleware/services/gui/uikit/proprietary/include + ${CMAKE_SOURCE_DIR}/middleware/services/gui/uikit/utils/interfaces/kits + ${CMAKE_SOURCE_DIR}/middleware/services/gui/uikit/utils/interfaces/innerkits ) set(PRIVATE_DEFINES diff --git a/code/sdk/drivers/peripheral/utilscpp/custom_utilscpp.cpp b/code/sdk/drivers/peripheral/utilscpp/custom_utilscpp.cpp index a96b0fbe4..c3922b9c0 100644 --- a/code/sdk/drivers/peripheral/utilscpp/custom_utilscpp.cpp +++ b/code/sdk/drivers/peripheral/utilscpp/custom_utilscpp.cpp @@ -7,6 +7,7 @@ * 2023-02-24, Create file. \n */ +#include "gfx_utils/mem_check.h" #ifdef __cplusplus extern "C" { @@ -231,6 +232,11 @@ errcode_t uapi_dial_pkg_decompress(const char* dial_pkg_path,char* dial_bin_path } +void uapi_dump_meminfo(void) +{ + OHOS::MemCheck::GetInstance()->DumpMemInfo(); +} + #ifdef __cplusplus } #endif /* __cplusplus */ \ No newline at end of file diff --git a/code/sdk/drivers/peripheral/utilscpp/custom_utilscpp.h b/code/sdk/drivers/peripheral/utilscpp/custom_utilscpp.h index 58ab94353..718a62bbc 100644 --- a/code/sdk/drivers/peripheral/utilscpp/custom_utilscpp.h +++ b/code/sdk/drivers/peripheral/utilscpp/custom_utilscpp.h @@ -15,6 +15,7 @@ extern "C" { #include errcode_t uapi_dial_pkg_decompress(const char* dial_pkg_path,char* dial_bin_path); +void uapi_dump_meminfo(void); #ifdef __cplusplus } diff --git a/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/kernel/base/sched/sched_sq/los_sched.c b/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/kernel/base/sched/sched_sq/los_sched.c index 8d1a02667..e07cf2a20 100755 --- a/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/kernel/base/sched/sched_sq/los_sched.c +++ b/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/kernel/base/sched/sched_sq/los_sched.c @@ -39,7 +39,11 @@ #ifdef LOSCFG_KERNEL_PERF_PER_TASK #include "los_perf_pri.h" #endif - +static uint8_t custom_debug_flag=0; +void los_sched_debug_enable(uint8_t enable) +{ + custom_debug_flag = enable; +} VOID OsSchedResched(VOID) { LosTaskCB *runTask = NULL; @@ -85,6 +89,10 @@ VOID OsSchedResched(VOID) #ifdef LOSCFG_BASE_CORE_TSK_MONITOR OsTaskSwitchCheck(runTask, newTask); #endif + if (custom_debug_flag == 1) + printf("OsSchedResched tskrun=%s tskidrun=%d, prirun=%d, statrun=%d, tsknew=%s tskidnew=%d, prinew=%d, statnew=%d\r\n", + runTask->taskName,runTask->taskId,runTask->priority, runTask->taskStatus, + newTask->taskName,newTask->taskId,newTask->priority, newTask->taskStatus); LOS_TRACE(TASK_SWITCH, newTask->taskId, runTask->priority, runTask->taskStatus, newTask->priority, newTask->taskStatus); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp index 139ccbb34..2643b2779 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp @@ -177,7 +177,7 @@ void MemCheck::DumpMemInfo() count++; allocPtr = allocPtr->next; } - printf("total size: %d, max: %d, count: %d\n", total, max, count); + printf("total size=%d, max=%d, count=%d\n", total, max, count); #if SUPPRESS_DUMP printf("--------\n"); GrallocEngines::GetInstance()->DumpMem(); -- 2.17.1