Compare commits
14 Commits
weekly_202
...
OpenHarmon
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8f3f9674c | ||
|
|
5cfec18d24 | ||
|
|
def41f8edd | ||
|
|
6881d3da46 | ||
|
|
e21e8753d1 | ||
|
|
397f24dd6f | ||
|
|
831d089652 | ||
|
|
f5fa92feff | ||
|
|
bed1d28df8 | ||
|
|
efebc00f87 | ||
|
|
28c1529e2f | ||
|
|
159d304275 | ||
|
|
18f65ae0b3 | ||
|
|
c6958aa181 |
5
Kconfig
5
Kconfig
@@ -597,6 +597,11 @@ config VM_OVERLAP_CHECK
|
||||
depends on DEBUG_VERSION && MEM_DEBUG
|
||||
help
|
||||
Answer Y to enable vm overlap check.
|
||||
|
||||
config TASK_MEM_USED
|
||||
bool "Enable show task mem used or not"
|
||||
default n
|
||||
depends on DEBUG_VERSION && MEM_DEBUG
|
||||
|
||||
endmenu
|
||||
|
||||
|
||||
@@ -117,7 +117,24 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsCpupGuardCreator(VOID)
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Function : OsCpupDaemonInit
|
||||
Description: initialization of CPUP Daemon
|
||||
Input : None
|
||||
Return : LOS_OK or Error Information
|
||||
*****************************************************************************/
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupDaemonInit()
|
||||
{
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
(VOID)OsCpupGuardCreator();
|
||||
g_irqCpupInitFlg = 1;
|
||||
#endif
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Function : OsCpupInit
|
||||
Description: initialization of CPUP
|
||||
@@ -127,32 +144,25 @@ Return : LOS_OK or Error Information
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit()
|
||||
{
|
||||
UINT32 size;
|
||||
CHAR *cpupMem = NULL;
|
||||
|
||||
size = g_taskMaxNum * sizeof(OsCpupCB);
|
||||
g_cpup = (OsCpupCB *)LOS_MemAlloc(m_aucSysMem0, size);
|
||||
|
||||
if (g_cpup == NULL) {
|
||||
return LOS_ERRNO_CPUP_NO_MEMORY;
|
||||
}
|
||||
|
||||
// Ignore the return code when matching CSEC rule 6.6(3).
|
||||
(VOID)memset_s(g_cpup, size, 0, size);
|
||||
g_cpupInitFlg = 1;
|
||||
|
||||
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
|
||||
size = LOSCFG_PLATFORM_HWI_LIMIT * sizeof(OsIrqCpupCB);
|
||||
g_irqCpup = (OsIrqCpupCB *)LOS_MemAlloc(m_aucSysMem0, size);
|
||||
if (g_irqCpup == NULL) {
|
||||
size += LOSCFG_PLATFORM_HWI_LIMIT * sizeof(OsIrqCpupCB);
|
||||
#endif
|
||||
|
||||
cpupMem = LOS_MemAlloc(m_aucSysMem0, size);
|
||||
if (cpupMem == NULL) {
|
||||
return LOS_ERRNO_CPUP_NO_MEMORY;
|
||||
}
|
||||
(VOID)memset_s(cpupMem, size, 0, size);
|
||||
|
||||
(VOID)memset_s(g_irqCpup, size, 0, size);
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
(VOID)OsCpupGuardCreator();
|
||||
g_irqCpupInitFlg = 1;
|
||||
g_cpup = (OsCpupCB *)cpupMem;
|
||||
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
|
||||
g_irqCpup = (OsIrqCpupCB *)(cpupMem + g_taskMaxNum * sizeof(OsCpupCB));
|
||||
#endif
|
||||
|
||||
#endif
|
||||
g_cpupInitFlg = 1;
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
@@ -171,6 +171,7 @@ typedef struct {
|
||||
*/
|
||||
extern UINT32 OsCpupInit(VOID);
|
||||
|
||||
extern UINT32 OsCpupDaemonInit(VOID);
|
||||
/**
|
||||
* @ingroup los_cpup
|
||||
* @brief Start task to get cycles count in current task ending.
|
||||
|
||||
@@ -33,6 +33,7 @@ module_name = get_path_info(rebase_path("."), "name")
|
||||
kernel_module(module_name) {
|
||||
sources = [
|
||||
"los_hwidump.c",
|
||||
"los_schedtrace.c",
|
||||
"los_stackdump.c",
|
||||
]
|
||||
configs += [ "$LITEOSTOPDIR:warn_config" ]
|
||||
|
||||
@@ -40,17 +40,46 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* StackDump print format */
|
||||
#define PRINT_PER_ROW 4
|
||||
|
||||
/* Shell Callback */
|
||||
/* SchedTrace records number */
|
||||
#define TRACE_NUM 200
|
||||
|
||||
/* sched trace info, users can add their own */
|
||||
typedef struct {
|
||||
UINT32 newTaskID;
|
||||
CHAR newTaskName[LOS_TASK_NAMELEN];
|
||||
UINT32 runTaskID;
|
||||
CHAR runTaskName[LOS_TASK_NAMELEN];
|
||||
} SchedTraceInfo;
|
||||
|
||||
/* SchedTrace record callback */
|
||||
typedef void (*SchedTraceRecordCB)(LosTaskCB *newTask, LosTaskCB *runTask);
|
||||
|
||||
/* SchedTrace show callback, buf is overwrite ringbuf, max amount of storage is TRACE_NUM */
|
||||
typedef void (*SchedTraceShowCB)(SchedTraceInfo *ringBuf, UINT32 count);
|
||||
|
||||
/* Shell callback */
|
||||
extern UINT32 OsShellCmdStackDump(INT32 argc, const CHAR **argv);
|
||||
extern UINT32 OsShellCmdHwiDump(INT32 argc, const CHAR **argv);
|
||||
extern UINT32 OsShellCmdSchedTrace(INT32 argc, const CHAR **argv);
|
||||
|
||||
/* other module Callback */
|
||||
/* Other module callback */
|
||||
extern VOID OsSchedTraceRecord(LosTaskCB *newTask, LosTaskCB *runTask);
|
||||
|
||||
/* External Interface */
|
||||
/* External interface */
|
||||
/* dump stack by task id, can be called at any time */
|
||||
extern VOID LOS_TaskStackDump(UINT32 taskID);
|
||||
|
||||
/* register sched trace handle, If not registered, the default fun will be used */
|
||||
extern VOID LOS_SchedTraceHandleRegister(SchedTraceRecordCB recordCB, SchedTraceShowCB showCB);
|
||||
/* start sched trace, will alloc buf, and start write to buf when sched */
|
||||
extern VOID LOS_SchedTraceStart(VOID);
|
||||
/* stop sched trace, will stop record and free buf */
|
||||
extern VOID LOS_SchedTraceStop(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ STATIC VOID ShellCmdHwiInfoShow(OsIrqCpupCB *irqData, CPUP_INFO_S *hwiCpup1s,
|
||||
}
|
||||
irqName = OsGetHwiFormName(i);
|
||||
|
||||
PRINTK(" %10u:%11u%11llu%10llu%9u.%-2u%9u.%-2u %-12s\n", i - OS_SYS_VECTOR_CNT, count, cycles, timeMax,
|
||||
PRINTK(" %10d:%11u%11llu%10llu%9u.%-2u%9u.%-2u %-12s\n", i - OS_SYS_VECTOR_CNT, count, cycles, timeMax,
|
||||
hwiCpup1s[i].uwUsage / CPUP_PRECISION_MULT, hwiCpup1s[i].uwUsage % CPUP_PRECISION_MULT,
|
||||
hwiCpup10s[i].uwUsage / CPUP_PRECISION_MULT, hwiCpup10s[i].uwUsage % CPUP_PRECISION_MULT,
|
||||
(irqName != NULL) ? irqName : NULL);
|
||||
|
||||
164
components/debugtools/los_schedtrace.c
Normal file
164
components/debugtools/los_schedtrace.c
Normal file
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "los_debugtools.h"
|
||||
#include "securec.h"
|
||||
#include "los_debug.h"
|
||||
#include "los_memory.h"
|
||||
#include "los_arch.h"
|
||||
|
||||
#if (LOSCFG_DEBUG_TOOLS == 1)
|
||||
STATIC BOOL g_startTrace = FALSE;
|
||||
STATIC SchedTraceInfo *g_traceRingBuf = NULL;
|
||||
STATIC UINT32 g_schedCount = 0;
|
||||
STATIC SchedTraceRecordCB g_recordCB = NULL;
|
||||
STATIC SchedTraceShowCB g_showCB = NULL;
|
||||
|
||||
STATIC VOID DefaultShowFormat(SchedTraceInfo *buf, UINT32 count)
|
||||
{
|
||||
INT32 i;
|
||||
UINT32 cycle = count / TRACE_NUM;
|
||||
UINT32 point = count % TRACE_NUM;
|
||||
|
||||
PRINTK ("sched %u time, last %u is:\r\n", count, TRACE_NUM);
|
||||
PRINTK("RunTaskID RunTaskName NewTaskID NewTaskName \r\n");
|
||||
if (cycle > 0) {
|
||||
for (i = point; i < TRACE_NUM; i++) {
|
||||
PRINTK("%4u %20s, %4u %20s\n",
|
||||
g_traceRingBuf[i].runTaskID, g_traceRingBuf[i].runTaskName,
|
||||
g_traceRingBuf[i].newTaskID, g_traceRingBuf[i].newTaskName);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < point; i++) {
|
||||
PRINTK("%4u %20s, %4u %20s\n",
|
||||
g_traceRingBuf[i].runTaskID, g_traceRingBuf[i].runTaskName,
|
||||
g_traceRingBuf[i].newTaskID, g_traceRingBuf[i].newTaskName);
|
||||
}
|
||||
|
||||
PRINTK("\r\n");
|
||||
}
|
||||
|
||||
STATIC VOID DefaultRecordHandle(LosTaskCB *newTask, LosTaskCB *runTask)
|
||||
{
|
||||
UINT32 point = g_schedCount % TRACE_NUM;
|
||||
|
||||
g_traceRingBuf[point].newTaskID = newTask->taskID;
|
||||
(VOID)memcpy_s(g_traceRingBuf[point].newTaskName, LOS_TASK_NAMELEN, newTask->taskName, LOS_TASK_NAMELEN);
|
||||
g_traceRingBuf[point].runTaskID = runTask->taskID;
|
||||
(VOID)memcpy_s(g_traceRingBuf[point].runTaskName, LOS_TASK_NAMELEN, runTask->taskName, LOS_TASK_NAMELEN);
|
||||
|
||||
g_schedCount++;
|
||||
}
|
||||
|
||||
STATIC VOID ShowFormat(SchedTraceInfo *buf, UINT32 count)
|
||||
{
|
||||
if (count == 0) {
|
||||
PRINT_ERR("none shed happend\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_showCB != NULL) {
|
||||
g_showCB(buf, count);
|
||||
}
|
||||
}
|
||||
|
||||
VOID OsSchedTraceRecord(LosTaskCB *newTask, LosTaskCB *runTask)
|
||||
{
|
||||
if (g_startTrace == FALSE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_recordCB != NULL) {
|
||||
g_recordCB(newTask, runTask);
|
||||
}
|
||||
}
|
||||
|
||||
VOID LOS_SchedTraceStart(VOID)
|
||||
{
|
||||
if (g_recordCB == NULL) {
|
||||
g_recordCB = DefaultRecordHandle;
|
||||
}
|
||||
|
||||
g_traceRingBuf = (SchedTraceInfo *)LOS_MemAlloc(OS_SYS_MEM_ADDR, TRACE_NUM * sizeof(SchedTraceInfo));
|
||||
if (g_traceRingBuf == NULL) {
|
||||
PRINT_ERR("alloc failed for dump\n");
|
||||
return;
|
||||
}
|
||||
(VOID)memset_s(g_traceRingBuf, TRACE_NUM * sizeof(SchedTraceInfo), 0, TRACE_NUM * sizeof(SchedTraceInfo));
|
||||
|
||||
g_startTrace = TRUE;
|
||||
}
|
||||
|
||||
VOID LOS_SchedTraceStop(VOID)
|
||||
{
|
||||
if (g_showCB == NULL) {
|
||||
g_showCB = DefaultShowFormat;
|
||||
}
|
||||
g_startTrace = FALSE;
|
||||
ShowFormat(g_traceRingBuf, g_schedCount);
|
||||
g_schedCount = 0;
|
||||
|
||||
if (g_traceRingBuf != NULL) {
|
||||
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, g_traceRingBuf);
|
||||
g_traceRingBuf = NULL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
VOID LOS_SchedTraceHandleRegister(SchedTraceRecordCB recordCB, SchedTraceShowCB showCB)
|
||||
{
|
||||
g_recordCB = recordCB;
|
||||
g_showCB = showCB;
|
||||
}
|
||||
|
||||
UINT32 OsShellCmdSchedTrace(INT32 argc, const CHAR **argv)
|
||||
{
|
||||
if (argc != 1) {
|
||||
PRINT_ERR("\nUsage: st -h\n");
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
if (strcmp(argv[0], "-s") == 0) {
|
||||
LOS_SchedTraceStart();
|
||||
} else if (strcmp(argv[0], "-e") == 0) {
|
||||
LOS_SchedTraceStop();
|
||||
} else if (strcmp(argv[0], "-h") == 0) {
|
||||
PRINTK("\nUsage: \nst -s , SchedTrace start\n");
|
||||
PRINTK("st -e , SchedTrace end and show\n");
|
||||
} else {
|
||||
PRINTK("\nUsage: st -h\n");
|
||||
return OS_ERROR;
|
||||
}
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif /* LOSCFG_STACK_DUMP == 1 */
|
||||
@@ -94,6 +94,7 @@ extern INT32 VfsNormalizePath(const CHAR *directory, const CHAR *filename, CHAR
|
||||
extern INT32 OsShellCmdDate(INT32 argc, const CHAR **argv);
|
||||
extern INT32 OsShellCmdDumpTask(INT32 argc, const CHAR **argv);
|
||||
extern UINT32 OsShellCmdFree(INT32 argc, const CHAR **argv);
|
||||
extern UINT32 OsShellCmdWaterLine(INT32 argc, const CHAR **argv);
|
||||
extern UINT32 lwip_ifconfig(INT32 argc, const CHAR **argv);
|
||||
extern UINT32 OsShellPing(INT32 argc, const CHAR **argv);
|
||||
extern INT32 OsShellCmdTouch(INT32 argc, const CHAR **argv);
|
||||
|
||||
@@ -51,6 +51,9 @@ CmdItem g_shellcmdAll[] = {
|
||||
{CMD_TYPE_STD, "date", XARGS, (CmdCallBackFunc)OsShellCmdDate},
|
||||
{CMD_TYPE_EX, "task", 1, (CmdCallBackFunc)OsShellCmdDumpTask},
|
||||
{CMD_TYPE_EX, "free", XARGS, (CmdCallBackFunc)OsShellCmdFree},
|
||||
#if (LOSCFG_MEM_WATERLINE == 1)
|
||||
{CMD_TYPE_EX, "memusage", XARGS, (CmdCallBackFunc)OsShellCmdWaterLine},
|
||||
#endif
|
||||
#ifdef LWIP_SHELLCMD_ENABLE
|
||||
{CMD_TYPE_EX, "ifconfig", XARGS, (CmdCallBackFunc)lwip_ifconfig},
|
||||
{CMD_TYPE_EX, "ping", XARGS, (CmdCallBackFunc)OsShellPing},
|
||||
@@ -69,6 +72,7 @@ CmdItem g_shellcmdAll[] = {
|
||||
#if (LOSCFG_DEBUG_TOOLS == 1)
|
||||
{CMD_TYPE_EX, "stack", 1, (CmdCallBackFunc)OsShellCmdStackDump},
|
||||
{CMD_TYPE_EX, "hwi", 1, (CmdCallBackFunc)OsShellCmdHwiDump},
|
||||
{CMD_TYPE_EX, "st", 1, (CmdCallBackFunc)OsShellCmdSchedTrace},
|
||||
#endif
|
||||
{CMD_TYPE_EX, "help", 0, (CmdCallBackFunc)OsShellCmdHelp},
|
||||
};
|
||||
|
||||
@@ -79,3 +79,32 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdFree(INT32 argc, const CHAR *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if (LOSCFG_MEM_WATERLINE == 1)
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdWaterLine(INT32 argc, const CHAR *argv[])
|
||||
{
|
||||
UINT32 ret;
|
||||
LOS_MEM_POOL_STATUS poolStatus;
|
||||
|
||||
if (argc > 1) {
|
||||
PRINTK("\nUsage: memusage or memusage [-k/-m]\n");
|
||||
return OS_ERROR;
|
||||
}
|
||||
|
||||
if (LOS_MemInfoGet(m_aucSysMem0, &poolStatus) != LOS_OK) {
|
||||
return OS_ERROR;
|
||||
}
|
||||
|
||||
if ((argc == 1) && (strcmp(argv[0], "-k") == 0)) {
|
||||
PRINTK("Mem WaterLine: %-9u\n", MEM_SIZE_TO_KB(poolStatus.usageWaterLine));
|
||||
} else if ((argc == 1) && (strcmp(argv[0], "-m") == 0)) {
|
||||
PRINTK("Mem WaterLine: %-9u\n", MEM_SIZE_TO_MB(poolStatus.usageWaterLine));
|
||||
} else if (argc == 0) {
|
||||
PRINTK("Mem WaterLine: %-9u\n", poolStatus.usageWaterLine);
|
||||
} else {
|
||||
PRINTK("\nUsage: memusage or memusage [-k/-m]\n");
|
||||
return OS_ERROR;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -46,4 +46,11 @@
|
||||
|
||||
#include_next <sys/select.h>
|
||||
|
||||
#ifdef LOSCFG_ARCH_RISCV
|
||||
#ifdef FD_ISSET(d, s)
|
||||
#undef FD_ISSET(d, s)
|
||||
#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif //_ADAPT_SYS_SELECT_H
|
||||
|
||||
@@ -181,6 +181,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
OsTaskMonInit();
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
ret = OsCpupInit();
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("OsCpupInit error\n");
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_IPC_SEM == 1)
|
||||
ret = OsSemInit();
|
||||
if (ret != LOS_OK) {
|
||||
@@ -211,12 +219,12 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
ret = OsCpupInit();
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("OsCpupInit error\n");
|
||||
return ret;
|
||||
}
|
||||
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
|
||||
ret = OsCpupDaemonInit();
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("OsCpupDaemonInit error\n");
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_FS_VFS == 1)
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#if (LOSCFG_KERNEL_PM == 1)
|
||||
#include "los_pm.h"
|
||||
#endif
|
||||
#if (LOSCFG_DEBUG_TOOLS == 1)
|
||||
#include "los_debugtools.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -547,6 +550,9 @@ BOOL OsSchedTaskSwitch(VOID)
|
||||
isTaskSwitch = TRUE;
|
||||
|
||||
OsHookCall(LOS_HOOK_TYPE_TASK_SWITCHEDIN);
|
||||
#if (LOSCFG_DEBUG_TOOLS == 1)
|
||||
OsSchedTraceRecord(newTask, runTask);
|
||||
#endif
|
||||
}
|
||||
|
||||
OsSchedTaskDeQueue(newTask);
|
||||
|
||||
@@ -157,7 +157,7 @@ STATIC VOID OsRecycleTaskResources(LosTaskCB *taskCB, UINTPTR *stackPtr)
|
||||
}
|
||||
}
|
||||
|
||||
STATIC VOID OsRecyleFinishedTask(VOID)
|
||||
STATIC VOID OsRecycleFinishedTask(VOID)
|
||||
{
|
||||
LosTaskCB *taskCB = NULL;
|
||||
UINT32 intSave;
|
||||
@@ -197,7 +197,7 @@ UINT32 OsPmEnterHandlerSet(VOID (*func)(VOID))
|
||||
LITE_OS_SEC_TEXT VOID OsIdleTask(VOID)
|
||||
{
|
||||
while (1) {
|
||||
OsRecyleFinishedTask();
|
||||
OsRecycleFinishedTask();
|
||||
|
||||
if (PmEnter != NULL) {
|
||||
PmEnter();
|
||||
@@ -307,18 +307,28 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskCpupInfo(CPUP_INFO_S **cpuLessOneSec,
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsPrintAllTskInfoHeader(VOID)
|
||||
{
|
||||
PRINTK("\r\n TID Priority Status StackSize WaterLine StackPoint TopOfStack EventMask SemID");
|
||||
#if (LOSCFG_TASK_MEM_USED == 1)
|
||||
PRINTK(" AllocSize");
|
||||
#endif
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
PRINTK(" CPUUSE CPUUSE10s CPUUSE1s ");
|
||||
#endif /* LOSCFG_BASE_CORE_CPUP */
|
||||
PRINTK(" TaskEntry name\n");
|
||||
PRINTK(" --- -------- -------- ");
|
||||
PRINTK("--------- --------- ---------- ---------- --------- ------ ");
|
||||
#if (LOSCFG_TASK_MEM_USED == 1)
|
||||
PRINTK("--------- ");
|
||||
#endif
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
PRINTK("------- --------- -------- ");
|
||||
#endif /* LOSCFG_BASE_CORE_CPUP */
|
||||
PRINTK("---------- ----\n");
|
||||
}
|
||||
|
||||
#if (LOSCFG_TASK_MEM_USED == 1)
|
||||
STATIC UINT32 g_taskMemUsed[LOSCFG_BASE_CORE_TSK_LIMIT + 1];
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Function : OsGetAllTskInfo
|
||||
Description : Get all task info.
|
||||
@@ -338,6 +348,11 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
|
||||
CPUP_INFO_S *cpuOneSec = (CPUP_INFO_S *)NULL;
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_TASK_MEM_USED == 1)
|
||||
(VOID)memset_s(g_taskMemUsed, sizeof(UINT32) * g_taskMaxNum, 0, sizeof(UINT32) * g_taskMaxNum);
|
||||
OsTaskMemUsed((VOID *)OS_SYS_MEM_ADDR, g_taskMemUsed, g_taskMaxNum);
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
if (OsGetAllTskCpupInfo(&cpuLessOneSec, &cpuTenSec, &cpuOneSec) != LOS_OK) {
|
||||
return OS_ERROR;
|
||||
@@ -357,6 +372,9 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
|
||||
taskCB->taskID, taskCB->priority, OsConvertTskStatus(taskCB->taskStatus),
|
||||
taskCB->stackSize, OsGetTaskWaterLine(taskCB->taskID),
|
||||
(UINT32)(UINTPTR)taskCB->stackPointer, taskCB->topOfStack, taskCB->eventMask, semID);
|
||||
#if (LOSCFG_TASK_MEM_USED == 1)
|
||||
PRINTK("%#10x", g_taskMemUsed[loopNum]);
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
PRINTK("%6u.%-2u%7u.%-2u%6u.%-2u ",
|
||||
@@ -759,7 +777,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreateOnly(UINT32 *taskID, TSK_INIT_PARAM_S
|
||||
return retVal;
|
||||
}
|
||||
|
||||
OsRecyleFinishedTask();
|
||||
OsRecycleFinishedTask();
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
if (LOS_ListEmpty(&g_losFreeTask)) {
|
||||
@@ -1508,5 +1526,5 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_Msleep(UINT32 mSecs)
|
||||
|
||||
VOID LOS_TaskResRecycle(VOID)
|
||||
{
|
||||
OsRecyleFinishedTask();
|
||||
OsRecycleFinishedTask();
|
||||
}
|
||||
|
||||
@@ -853,13 +853,13 @@ LITE_TEST_CASE(PthreadFuncTestSuite, TestPthread013, Function | MediumTest | Lev
|
||||
|
||||
ret = pthread_condattr_getclock(&condattr, &clk);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
ICUNIT_ASSERT_EQUAL(clk, 0, clk);
|
||||
ICUNIT_ASSERT_EQUAL(clk, CLOCK_REALTIME, clk);
|
||||
|
||||
ret = pthread_condattr_setclock(&condattr, 0);
|
||||
ret = pthread_condattr_setclock(&condattr, CLOCK_REALTIME);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
ret = pthread_condattr_getclock(&condattr, &clk);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
ICUNIT_ASSERT_EQUAL(clk, 0, clk);
|
||||
ICUNIT_ASSERT_EQUAL(clk, CLOCK_REALTIME, clk);
|
||||
|
||||
struct timespec ts = {0};
|
||||
ret = clock_getres(CLOCK_MONOTONIC, &ts);
|
||||
|
||||
Reference in New Issue
Block a user