!861 feat: 优化调度debug功能
Merge pull request !861 from zhushengle/sched_stat
This commit is contained in:
commit
ccbc55df60
|
@ -65,10 +65,10 @@ kernel_module(module_name) {
|
||||||
"mp/los_mp.c",
|
"mp/los_mp.c",
|
||||||
"mp/los_percpu.c",
|
"mp/los_percpu.c",
|
||||||
"mp/los_spinlock.c",
|
"mp/los_spinlock.c",
|
||||||
"mp/los_stat.c",
|
|
||||||
"om/los_err.c",
|
"om/los_err.c",
|
||||||
"sched/sched_sq/los_sched.c",
|
"sched/los_sched.c",
|
||||||
"sched/sched_sq/los_sortlink.c",
|
"sched/los_sortlink.c",
|
||||||
|
"sched/los_statistics.c",
|
||||||
"vm/los_vm_boot.c",
|
"vm/los_vm_boot.c",
|
||||||
"vm/los_vm_dump.c",
|
"vm/los_vm_dump.c",
|
||||||
"vm/los_vm_fault.c",
|
"vm/los_vm_fault.c",
|
||||||
|
|
|
@ -37,7 +37,7 @@ LOCAL_SRCS := $(wildcard ipc/*.c) $(wildcard core/*.c) $(wildcard mem/membox/*.
|
||||||
$(wildcard misc/*.c)\
|
$(wildcard misc/*.c)\
|
||||||
$(wildcard mem/tlsf/*.c) \
|
$(wildcard mem/tlsf/*.c) \
|
||||||
$(wildcard mp/*.c) \
|
$(wildcard mp/*.c) \
|
||||||
$(wildcard sched/sched_sq/*.c) \
|
$(wildcard sched/*.c) \
|
||||||
$(wildcard vm/*.c)
|
$(wildcard vm/*.c)
|
||||||
|
|
||||||
LOCAL_FLAGS := $(LITEOS_CFLAGS_INTERWORK)
|
LOCAL_FLAGS := $(LITEOS_CFLAGS_INTERWORK)
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include "los_hwi.h"
|
#include "los_hwi.h"
|
||||||
#include "hal_timer.h"
|
#include "hal_timer.h"
|
||||||
#ifdef LOSCFG_SCHED_DEBUG
|
#ifdef LOSCFG_SCHED_DEBUG
|
||||||
#include "los_stat_pri.h"
|
#include "los_statistics_pri.h"
|
||||||
#endif
|
#endif
|
||||||
#include "los_stackinfo_pri.h"
|
#include "los_stackinfo_pri.h"
|
||||||
#include "los_futex_pri.h"
|
#include "los_futex_pri.h"
|
||||||
|
@ -531,13 +531,6 @@ VOID OsSchedIrqEndCheckNeedSched(VOID);
|
||||||
*/
|
*/
|
||||||
LOS_DL_LIST *OsSchedLockPendFindPos(const LosTaskCB *runTask, LOS_DL_LIST *lockList);
|
LOS_DL_LIST *OsSchedLockPendFindPos(const LosTaskCB *runTask, LOS_DL_LIST *lockList);
|
||||||
|
|
||||||
#ifdef LOSCFG_SCHED_DEBUG
|
|
||||||
#ifdef LOSCFG_SCHED_TICK_DEBUG
|
|
||||||
VOID OsSchedDebugRecordData(VOID);
|
|
||||||
#endif
|
|
||||||
UINT32 OsShellShowTickRespo(VOID);
|
|
||||||
UINT32 OsShellShowSchedParam(VOID);
|
|
||||||
#endif
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,11 +40,6 @@ extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT64 runtime;
|
|
||||||
UINT32 contexSwitch;
|
|
||||||
} SchedPercpu;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT64 allRuntime;
|
UINT64 allRuntime;
|
||||||
UINT64 runTime;
|
UINT64 runTime;
|
||||||
|
@ -56,9 +51,17 @@ typedef struct {
|
||||||
UINT64 pendCount;
|
UINT64 pendCount;
|
||||||
UINT64 waitSchedTime; /* task status is ready to running times */
|
UINT64 waitSchedTime; /* task status is ready to running times */
|
||||||
UINT64 waitSchedCount;
|
UINT64 waitSchedCount;
|
||||||
SchedPercpu schedPercpu[LOSCFG_KERNEL_CORE_NUM];
|
|
||||||
} SchedStat;
|
} SchedStat;
|
||||||
|
|
||||||
|
#ifdef LOSCFG_SCHED_DEBUG
|
||||||
|
#ifdef LOSCFG_SCHED_TICK_DEBUG
|
||||||
|
VOID OsSchedDebugRecordData(VOID);
|
||||||
|
UINT32 OsShellShowTickResponse(VOID);
|
||||||
|
UINT32 OsShellShowSchedStatistics(VOID);
|
||||||
|
UINT32 OsSchedDebugInit(VOID);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
}
|
}
|
|
@ -617,13 +617,13 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdDumpTask(INT32 argc, const CHAR **argv)
|
||||||
#ifdef LOSCFG_SCHED_DEBUG
|
#ifdef LOSCFG_SCHED_DEBUG
|
||||||
#ifdef LOSCFG_SCHED_TICK_DEBUG
|
#ifdef LOSCFG_SCHED_TICK_DEBUG
|
||||||
} else if (strcmp("-i", argv[0]) == 0) {
|
} else if (strcmp("-i", argv[0]) == 0) {
|
||||||
if (!OsShellShowTickRespo()) {
|
if (!OsShellShowTickResponse()) {
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
goto TASK_HELP;
|
goto TASK_HELP;
|
||||||
#endif
|
#endif
|
||||||
} else if (strcmp("-t", argv[0]) == 0) {
|
} else if (strcmp("-t", argv[0]) == 0) {
|
||||||
if (!OsShellShowSchedParam()) {
|
if (!OsShellShowSchedStatistics()) {
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
}
|
}
|
||||||
goto TASK_HELP;
|
goto TASK_HELP;
|
||||||
|
|
|
@ -1,323 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
|
||||||
* Copyright (c) 2020-2021 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_task_pri.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef LOSCFG_KERNEL_SCHED_STATISTICS
|
|
||||||
#define HIGHTASKPRI 16
|
|
||||||
#define NS_PER_MS 1000000
|
|
||||||
#define DECIMAL_TO_PERCENTAGE 100
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT64 idleRuntime;
|
|
||||||
UINT64 idleStarttime;
|
|
||||||
UINT64 highTaskRuntime;
|
|
||||||
UINT64 highTaskStarttime;
|
|
||||||
UINT64 spinWaitRuntime;
|
|
||||||
UINT64 sumPriority;
|
|
||||||
UINT32 prioritySwitch;
|
|
||||||
UINT32 highTaskSwitch;
|
|
||||||
UINT32 contexSwitch;
|
|
||||||
UINT32 hwiNum;
|
|
||||||
UINT32 ipiIrqNum;
|
|
||||||
} MpStatPercpu;
|
|
||||||
|
|
||||||
STATIC BOOL g_mpStaticStartFlag = FALSE;
|
|
||||||
STATIC UINT64 g_mpStaticStartTime;
|
|
||||||
STATIC MpStatPercpu g_mpStatPercpu[LOSCFG_KERNEL_SMP_CORE_NUM] = {0};
|
|
||||||
|
|
||||||
STATIC VOID OsMpSchedStatistics(LosTaskCB *runTask, LosTaskCB *newTask)
|
|
||||||
{
|
|
||||||
UINT32 cpuid;
|
|
||||||
UINT32 idleTaskID;
|
|
||||||
UINT64 now, runtime;
|
|
||||||
|
|
||||||
if (g_mpStaticStartFlag != TRUE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cpuid = ArchCurrCpuid();
|
|
||||||
idleTaskID = OsGetIdleTaskId();
|
|
||||||
now = LOS_CurrNanosec();
|
|
||||||
|
|
||||||
g_mpStatPercpu[cpuid].contexSwitch++;
|
|
||||||
|
|
||||||
if ((runTask->taskID != idleTaskID) && (newTask->taskID == idleTaskID)) {
|
|
||||||
g_mpStatPercpu[cpuid].idleStarttime = now;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((runTask->taskID == idleTaskID) && (newTask->taskID != idleTaskID)) {
|
|
||||||
runtime = now - g_mpStatPercpu[cpuid].idleStarttime;
|
|
||||||
g_mpStatPercpu[cpuid].idleRuntime += runtime;
|
|
||||||
g_mpStatPercpu[cpuid].idleStarttime = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((runTask->priority >= HIGHTASKPRI) && (newTask->priority < HIGHTASKPRI)) {
|
|
||||||
g_mpStatPercpu[cpuid].highTaskStarttime = now;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((runTask->priority < HIGHTASKPRI) && (newTask->priority >= HIGHTASKPRI)) {
|
|
||||||
runtime = now - g_mpStatPercpu[cpuid].highTaskStarttime;
|
|
||||||
g_mpStatPercpu[cpuid].highTaskRuntime += runtime;
|
|
||||||
g_mpStatPercpu[cpuid].highTaskStarttime = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newTask->priority < HIGHTASKPRI) {
|
|
||||||
g_mpStatPercpu[cpuid].highTaskSwitch++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newTask->taskID != idleTaskID) {
|
|
||||||
g_mpStatPercpu[cpuid].sumPriority += newTask->priority;
|
|
||||||
g_mpStatPercpu[cpuid].prioritySwitch++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LITE_OS_SEC_TEXT_MINOR VOID OsSchedStatistics(LosTaskCB *runTask, LosTaskCB *newTask)
|
|
||||||
{
|
|
||||||
UINT64 runtime;
|
|
||||||
UINT32 cpuid = ArchCurrCpuid();
|
|
||||||
UINT64 now = LOS_CurrNanosec();
|
|
||||||
|
|
||||||
SchedStat *schedRun = &runTask->schedStat;
|
|
||||||
SchedStat *schedNew = &newTask->schedStat;
|
|
||||||
SchedPercpu *cpuRun = &schedRun->schedPercpu[cpuid];
|
|
||||||
SchedPercpu *cpuNew = &schedNew->schedPercpu[cpuid];
|
|
||||||
|
|
||||||
/* calculate one chance of running time */
|
|
||||||
runtime = now - schedRun->startRuntime;
|
|
||||||
|
|
||||||
/* add running timer to running task statistics */
|
|
||||||
cpuRun->runtime += runtime;
|
|
||||||
schedRun->allRuntime += runtime;
|
|
||||||
|
|
||||||
/* add context switch counters and schedule start time */
|
|
||||||
cpuNew->contexSwitch++;
|
|
||||||
schedNew->allContextSwitch++;
|
|
||||||
schedNew->startRuntime = now;
|
|
||||||
OsMpSchedStatistics(runTask, newTask);
|
|
||||||
}
|
|
||||||
|
|
||||||
LITE_OS_SEC_TEXT_MINOR VOID OsSpinWaitStatistics(UINT64 spinWaitRuntime)
|
|
||||||
{
|
|
||||||
UINT32 cpuid = ArchCurrCpuid();
|
|
||||||
g_mpStatPercpu[cpuid].spinWaitRuntime += spinWaitRuntime;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LITE_OS_SEC_TEXT_MINOR VOID OsHwiStatistics(size_t intNum)
|
|
||||||
{
|
|
||||||
UINT32 cpuid = ArchCurrCpuid();
|
|
||||||
|
|
||||||
if ((g_mpStaticStartFlag != TRUE) || (intNum == OS_TICK_INT_NUM)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_mpStatPercpu[cpuid].hwiNum++;
|
|
||||||
/* 16: 0~15 is ipi interrupts */
|
|
||||||
if (intNum < 16) {
|
|
||||||
g_mpStatPercpu[cpuid].ipiIrqNum++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LITE_OS_SEC_TEXT_MINOR VOID OsShellCmdDumpSched(VOID)
|
|
||||||
{
|
|
||||||
LosTaskCB *taskCB = NULL;
|
|
||||||
UINT32 loop;
|
|
||||||
UINT32 cpuid;
|
|
||||||
UINT32 affinity;
|
|
||||||
|
|
||||||
PRINTK("\n");
|
|
||||||
PRINTK("Task TID Total Time Total CST "
|
|
||||||
"CPU Time CST\n");
|
|
||||||
PRINTK("---- --- ------------------ ---------- -"
|
|
||||||
"--- ------------------ ----------\n");
|
|
||||||
|
|
||||||
for (loop = 0; loop < g_taskMaxNum; loop++) {
|
|
||||||
taskCB = (((LosTaskCB *)g_taskCBArray) + loop);
|
|
||||||
if (OsTaskIsUnused(taskCB)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
affinity = (UINT32)taskCB->cpuAffiMask;
|
|
||||||
|
|
||||||
PRINTK("%-30s0x%-6x%+16lf ms %10u\n", taskCB->taskName, taskCB->taskID,
|
|
||||||
(DOUBLE)(taskCB->schedStat.allRuntime) / NS_PER_MS,
|
|
||||||
taskCB->schedStat.allContextSwitch);
|
|
||||||
|
|
||||||
for (cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) {
|
|
||||||
if (!((1U << cpuid) & affinity)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRINTK(" "
|
|
||||||
"CPU%u %+16lf ms %12u\n", cpuid,
|
|
||||||
(DOUBLE)(taskCB->schedStat.schedPercpu[cpuid].runtime) / NS_PER_MS,
|
|
||||||
taskCB->schedStat.schedPercpu[cpuid].contexSwitch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PRINTK("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
LITE_OS_SEC_TEXT_MINOR VOID OsShellMpStaticStart(VOID)
|
|
||||||
{
|
|
||||||
LosTaskCB *taskCB = NULL;
|
|
||||||
UINT32 loop;
|
|
||||||
UINT32 cpuid = 0;
|
|
||||||
UINT32 intSave;
|
|
||||||
|
|
||||||
SCHEDULER_LOCK(intSave);
|
|
||||||
|
|
||||||
if (g_mpStaticStartFlag) {
|
|
||||||
PRINT_WARN("mp static has started\n");
|
|
||||||
SCHEDULER_UNLOCK(intSave);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_mpStaticStartTime = LOS_CurrNanosec();
|
|
||||||
|
|
||||||
for (loop = 0; loop < g_taskMaxNum; loop++) {
|
|
||||||
taskCB = (((LosTaskCB *)g_taskCBArray) + loop);
|
|
||||||
if (taskCB->taskStatus & OS_TASK_STATUS_RUNNING) {
|
|
||||||
#ifdef LOSCFG_KERNEL_SMP
|
|
||||||
cpuid = taskCB->currCpu;
|
|
||||||
#endif
|
|
||||||
if ((UINT32)(OS_TASK_INVALID_CPUID) == cpuid) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!strcmp(taskCB->taskName, "Idle")) {
|
|
||||||
g_mpStatPercpu[cpuid].idleStarttime = g_mpStaticStartTime;
|
|
||||||
}
|
|
||||||
if (taskCB->priority < HIGHTASKPRI) {
|
|
||||||
g_mpStatPercpu[cpuid].highTaskStarttime = g_mpStaticStartTime;
|
|
||||||
g_mpStatPercpu[cpuid].highTaskSwitch++;
|
|
||||||
}
|
|
||||||
if (strcmp(taskCB->taskName, "Idle")) {
|
|
||||||
g_mpStatPercpu[cpuid].sumPriority += taskCB->priority;
|
|
||||||
g_mpStatPercpu[cpuid].prioritySwitch++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_mpStaticStartFlag = TRUE;
|
|
||||||
SCHEDULER_UNLOCK(intSave);
|
|
||||||
|
|
||||||
PRINTK("mp static start\n");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LITE_OS_SEC_TEXT_MINOR VOID OsMpStaticShow(UINT64 mpStaticPastTime)
|
|
||||||
{
|
|
||||||
UINT32 cpuid;
|
|
||||||
PRINTK("\n");
|
|
||||||
PRINTK("Passed Time: %+16lf ms\n", (DOUBLE)mpStaticPastTime / NS_PER_MS);
|
|
||||||
PRINTK("--------------------------------\n");
|
|
||||||
PRINTK("CPU Idle(%%) schedule noTick Hwi MP Hwi MP Loss(%%) "
|
|
||||||
"avg PRI HiTSK(%%) HiTSK SCH HiTSK P(ms)\n");
|
|
||||||
PRINTK("---- --------- ---------- ---------- ---------- ---------- "
|
|
||||||
"---------- ---------- ---------- ----------\n");
|
|
||||||
|
|
||||||
for (cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) {
|
|
||||||
PRINTK("CPU%u %+10lf%14u%14u%14u %+11lf %+11lf %+11lf%14u %+11lf\n", cpuid,
|
|
||||||
((DOUBLE)(g_mpStatPercpu[cpuid].idleRuntime) / mpStaticPastTime) * DECIMAL_TO_PERCENTAGE,
|
|
||||||
g_mpStatPercpu[cpuid].contexSwitch,
|
|
||||||
g_mpStatPercpu[cpuid].hwiNum,
|
|
||||||
g_mpStatPercpu[cpuid].ipiIrqNum,
|
|
||||||
((DOUBLE)(g_mpStatPercpu[cpuid].spinWaitRuntime) / mpStaticPastTime) * DECIMAL_TO_PERCENTAGE,
|
|
||||||
(g_mpStatPercpu[cpuid].prioritySwitch == 0) ? OS_TASK_PRIORITY_LOWEST :
|
|
||||||
((DOUBLE)(g_mpStatPercpu[cpuid].sumPriority) / (g_mpStatPercpu[cpuid].prioritySwitch)),
|
|
||||||
((DOUBLE)(g_mpStatPercpu[cpuid].highTaskRuntime) / mpStaticPastTime) * DECIMAL_TO_PERCENTAGE,
|
|
||||||
g_mpStatPercpu[cpuid].highTaskSwitch,
|
|
||||||
(g_mpStatPercpu[cpuid].highTaskSwitch == 0) ? 0 :
|
|
||||||
((DOUBLE)(g_mpStatPercpu[cpuid].highTaskRuntime) / (g_mpStatPercpu[cpuid].highTaskSwitch)) / NS_PER_MS);
|
|
||||||
}
|
|
||||||
|
|
||||||
PRINTK("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
LITE_OS_SEC_TEXT_MINOR VOID OsShellMpStaticStop(VOID)
|
|
||||||
{
|
|
||||||
LosTaskCB *taskCB = NULL;
|
|
||||||
UINT32 loop;
|
|
||||||
UINT32 cpuid = 0;
|
|
||||||
UINT64 mpStaticStopTime;
|
|
||||||
UINT64 mpStaticPastTime;
|
|
||||||
UINT64 runtime;
|
|
||||||
UINT32 intSave;
|
|
||||||
|
|
||||||
SCHEDULER_LOCK(intSave);
|
|
||||||
|
|
||||||
if (g_mpStaticStartFlag != TRUE) {
|
|
||||||
PRINT_WARN("Please set mp static start\n");
|
|
||||||
SCHEDULER_UNLOCK(intSave);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_mpStaticStartFlag = FALSE;
|
|
||||||
mpStaticStopTime = LOS_CurrNanosec();
|
|
||||||
mpStaticPastTime = mpStaticStopTime - g_mpStaticStartTime;
|
|
||||||
|
|
||||||
for (loop = 0; loop < g_taskMaxNum; loop++) {
|
|
||||||
taskCB = (((LosTaskCB *)g_taskCBArray) + loop);
|
|
||||||
if (taskCB->taskStatus & OS_TASK_STATUS_RUNNING) {
|
|
||||||
#ifdef LOSCFG_KERNEL_SMP
|
|
||||||
cpuid = taskCB->currCpu;
|
|
||||||
#endif
|
|
||||||
if (cpuid == (UINT32)(OS_TASK_INVALID_CPUID)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!strcmp(taskCB->taskName, "Idle")) {
|
|
||||||
runtime = mpStaticStopTime - g_mpStatPercpu[cpuid].idleStarttime;
|
|
||||||
g_mpStatPercpu[cpuid].idleRuntime += runtime;
|
|
||||||
g_mpStatPercpu[cpuid].idleStarttime = 0;
|
|
||||||
}
|
|
||||||
if (taskCB->priority < HIGHTASKPRI) {
|
|
||||||
runtime = mpStaticStopTime - g_mpStatPercpu[cpuid].highTaskStarttime;
|
|
||||||
g_mpStatPercpu[cpuid].highTaskRuntime += runtime;
|
|
||||||
g_mpStatPercpu[cpuid].highTaskStarttime = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SCHEDULER_UNLOCK(intSave);
|
|
||||||
OsMpStaticShow(mpStaticPastTime);
|
|
||||||
|
|
||||||
(VOID)memset_s(g_mpStatPercpu, sizeof(g_mpStatPercpu), 0, sizeof(g_mpStatPercpu));
|
|
||||||
g_mpStaticStartTime = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "los_mp.h"
|
#include "los_mp.h"
|
||||||
#ifdef LOSCFG_SCHED_DEBUG
|
#ifdef LOSCFG_SCHED_DEBUG
|
||||||
#include "los_stat_pri.h"
|
#include "los_statistics_pri.h"
|
||||||
#endif
|
#endif
|
||||||
#include "los_pm_pri.h"
|
#include "los_pm_pri.h"
|
||||||
|
|
||||||
|
@ -76,167 +76,6 @@ typedef struct {
|
||||||
SchedRunQue g_schedRunQue[LOSCFG_KERNEL_CORE_NUM];
|
SchedRunQue g_schedRunQue[LOSCFG_KERNEL_CORE_NUM];
|
||||||
STATIC Sched g_sched;
|
STATIC Sched g_sched;
|
||||||
|
|
||||||
#ifdef LOSCFG_SCHED_TICK_DEBUG
|
|
||||||
#define OS_SCHED_DEBUG_DATA_NUM 1000
|
|
||||||
typedef struct {
|
|
||||||
UINT32 tickResporeTime[OS_SCHED_DEBUG_DATA_NUM];
|
|
||||||
UINT32 index;
|
|
||||||
UINT32 setTickCount;
|
|
||||||
UINT64 oldResporeTime;
|
|
||||||
} SchedTickDebug;
|
|
||||||
STATIC SchedTickDebug *g_schedTickDebug = NULL;
|
|
||||||
|
|
||||||
STATIC UINT32 OsSchedDebugInit(VOID)
|
|
||||||
{
|
|
||||||
UINT32 size = sizeof(SchedTickDebug) * LOSCFG_KERNEL_CORE_NUM;
|
|
||||||
g_schedTickDebug = (SchedTickDebug *)LOS_MemAlloc(m_aucSysMem0, size);
|
|
||||||
if (g_schedTickDebug == NULL) {
|
|
||||||
return LOS_ERRNO_TSK_NO_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
(VOID)memset_s(g_schedTickDebug, size, 0, size);
|
|
||||||
return LOS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID OsSchedDebugRecordData(VOID)
|
|
||||||
{
|
|
||||||
SchedTickDebug *schedDebug = &g_schedTickDebug[ArchCurrCpuid()];
|
|
||||||
if (schedDebug->index < OS_SCHED_DEBUG_DATA_NUM) {
|
|
||||||
UINT64 currTime = OsGetCurrSchedTimeCycle();
|
|
||||||
schedDebug->tickResporeTime[schedDebug->index] = currTime - schedDebug->oldResporeTime;
|
|
||||||
schedDebug->oldResporeTime = currTime;
|
|
||||||
schedDebug->index++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SchedTickDebug *OsSchedDebugGet(VOID)
|
|
||||||
{
|
|
||||||
return g_schedTickDebug;
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT32 OsShellShowTickRespo(VOID)
|
|
||||||
{
|
|
||||||
UINT32 intSave;
|
|
||||||
UINT16 cpu;
|
|
||||||
UINT64 allTime;
|
|
||||||
|
|
||||||
UINT32 tickSize = sizeof(SchedTickDebug) * LOSCFG_KERNEL_CORE_NUM;
|
|
||||||
SchedTickDebug *schedDebug = (SchedTickDebug *)LOS_MemAlloc(m_aucSysMem1, tickSize);
|
|
||||||
if (schedDebug == NULL) {
|
|
||||||
return LOS_NOK;
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT32 sortLinkNum[LOSCFG_KERNEL_CORE_NUM];
|
|
||||||
SCHEDULER_LOCK(intSave);
|
|
||||||
(VOID)memcpy_s((CHAR *)schedDebug, tickSize, (CHAR *)OsSchedDebugGet(), tickSize);
|
|
||||||
(VOID)memset_s((CHAR *)OsSchedDebugGet(), tickSize, 0, tickSize);
|
|
||||||
for (cpu = 0; cpu < LOSCFG_KERNEL_CORE_NUM; cpu++) {
|
|
||||||
SchedRunQue *rq = OsSchedRunQueByID(cpu);
|
|
||||||
sortLinkNum[cpu] = OsGetSortLinkNodeNum(&rq->taskSortLink);
|
|
||||||
}
|
|
||||||
SCHEDULER_UNLOCK(intSave);
|
|
||||||
|
|
||||||
for (cpu = 0; cpu < LOSCFG_KERNEL_CORE_NUM; cpu++) {
|
|
||||||
SchedTickDebug *schedData = &schedDebug[cpu];
|
|
||||||
PRINTK("cpu : %u sched data num : %u set time count : %u SortMax : %u\n",
|
|
||||||
cpu, schedData->index, schedData->setTickCount, sortLinkNum[cpu]);
|
|
||||||
UINT32 *data = schedData->tickResporeTime;
|
|
||||||
allTime = 0;
|
|
||||||
for (UINT32 i = 1; i < schedData->index; i++) {
|
|
||||||
allTime += data[i];
|
|
||||||
UINT32 timeUs = (data[i] * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
|
||||||
PRINTK(" %u(%u)", timeUs, timeUs / OS_US_PER_TICK);
|
|
||||||
if ((i != 0) && ((i % 5) == 0)) { /* A row of 5 data */
|
|
||||||
PRINTK("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allTime = (allTime * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
|
||||||
PRINTK("\nTick Indicates the average response period: %llu(us)\n", allTime / (schedData->index - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
(VOID)LOS_MemFree(m_aucSysMem1, schedDebug);
|
|
||||||
return LOS_OK;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LOSCFG_SCHED_DEBUG
|
|
||||||
STATIC VOID SchedDataGet(LosTaskCB *taskCB, UINT64 *runTime, UINT64 *timeSlice, UINT64 *pendTime, UINT64 *schedWait)
|
|
||||||
{
|
|
||||||
if (taskCB->schedStat.switchCount >= 1) {
|
|
||||||
UINT64 averRunTime = taskCB->schedStat.runTime / taskCB->schedStat.switchCount;
|
|
||||||
*runTime = (averRunTime * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (taskCB->schedStat.timeSliceCount > 1) {
|
|
||||||
UINT64 averTimeSlice = taskCB->schedStat.timeSliceTime / (taskCB->schedStat.timeSliceCount - 1);
|
|
||||||
*timeSlice = (averTimeSlice * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (taskCB->schedStat.pendCount > 1) {
|
|
||||||
UINT64 averPendTime = taskCB->schedStat.pendTime / taskCB->schedStat.pendCount;
|
|
||||||
*pendTime = (averPendTime * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (taskCB->schedStat.waitSchedCount > 0) {
|
|
||||||
UINT64 averSchedWait = taskCB->schedStat.waitSchedTime / taskCB->schedStat.waitSchedCount;
|
|
||||||
*schedWait = (averSchedWait * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT32 OsShellShowSchedParam(VOID)
|
|
||||||
{
|
|
||||||
UINT64 averRunTime;
|
|
||||||
UINT64 averTimeSlice;
|
|
||||||
UINT64 averSchedWait;
|
|
||||||
UINT64 averPendTime;
|
|
||||||
UINT32 taskLinkNum[LOSCFG_KERNEL_CORE_NUM];
|
|
||||||
UINT32 intSave;
|
|
||||||
UINT32 size = g_taskMaxNum * sizeof(LosTaskCB);
|
|
||||||
LosTaskCB *taskCBArray = LOS_MemAlloc(m_aucSysMem1, size);
|
|
||||||
if (taskCBArray == NULL) {
|
|
||||||
return LOS_NOK;
|
|
||||||
}
|
|
||||||
|
|
||||||
SCHEDULER_LOCK(intSave);
|
|
||||||
(VOID)memcpy_s(taskCBArray, size, g_taskCBArray, size);
|
|
||||||
for (UINT16 cpu = 0; cpu < LOSCFG_KERNEL_CORE_NUM; cpu++) {
|
|
||||||
SchedRunQue *rq = OsSchedRunQueByID(cpu);
|
|
||||||
taskLinkNum[cpu] = OsGetSortLinkNodeNum(&rq->taskSortLink);
|
|
||||||
}
|
|
||||||
SCHEDULER_UNLOCK(intSave);
|
|
||||||
|
|
||||||
for (UINT16 cpu = 0; cpu < LOSCFG_KERNEL_CORE_NUM; cpu++) {
|
|
||||||
PRINTK("cpu: %u Task SortMax: %u\n", cpu, taskLinkNum[cpu]);
|
|
||||||
}
|
|
||||||
|
|
||||||
PRINTK(" Tid AverRunTime(us) SwitchCount AverTimeSlice(us) TimeSliceCount AverReadyWait(us) "
|
|
||||||
"AverPendTime(us) TaskName \n");
|
|
||||||
for (UINT32 tid = 0; tid < g_taskMaxNum; tid++) {
|
|
||||||
LosTaskCB *taskCB = taskCBArray + tid;
|
|
||||||
if (OsTaskIsUnused(taskCB)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
averRunTime = 0;
|
|
||||||
averTimeSlice = 0;
|
|
||||||
averPendTime = 0;
|
|
||||||
averSchedWait = 0;
|
|
||||||
|
|
||||||
SchedDataGet(taskCB, &averRunTime, &averTimeSlice, &averPendTime, &averSchedWait);
|
|
||||||
|
|
||||||
PRINTK("%5u%19llu%15llu%19llu%18llu%19llu%18llu %-32s\n", taskCB->taskID,
|
|
||||||
averRunTime, taskCB->schedStat.switchCount,
|
|
||||||
averTimeSlice, taskCB->schedStat.timeSliceCount - 1,
|
|
||||||
averSchedWait, averPendTime, taskCB->taskName);
|
|
||||||
}
|
|
||||||
|
|
||||||
(VOID)LOS_MemFree(m_aucSysMem1, taskCBArray);
|
|
||||||
|
|
||||||
return LOS_OK;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
STATIC INLINE VOID TimeSliceUpdate(LosTaskCB *taskCB, UINT64 currTime)
|
STATIC INLINE VOID TimeSliceUpdate(LosTaskCB *taskCB, UINT64 currTime)
|
||||||
{
|
{
|
||||||
LOS_ASSERT(currTime >= taskCB->startTime);
|
LOS_ASSERT(currTime >= taskCB->startTime);
|
||||||
|
@ -294,13 +133,6 @@ STATIC INLINE VOID SchedSetNextExpireTime(UINT32 responseID, UINT64 taskEndTime,
|
||||||
|
|
||||||
UINT64 nextResponseTime = nextExpireTime - currTime;
|
UINT64 nextResponseTime = nextExpireTime - currTime;
|
||||||
rq->responseTime = currTime + HalClockTickTimerReload(nextResponseTime);
|
rq->responseTime = currTime + HalClockTickTimerReload(nextResponseTime);
|
||||||
|
|
||||||
#ifdef LOSCFG_SCHED_TICK_DEBUG
|
|
||||||
SchedTickDebug *schedDebug = &g_schedTickDebug[ArchCurrCpuid()];
|
|
||||||
if (schedDebug->index < OS_SCHED_DEBUG_DATA_NUM) {
|
|
||||||
schedDebug->setTickCount++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID OsSchedUpdateExpireTime(VOID)
|
VOID OsSchedUpdateExpireTime(VOID)
|
|
@ -0,0 +1,172 @@
|
||||||
|
/*
|
||||||
|
* 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_statistics_pri.h"
|
||||||
|
#include "los_task_pri.h"
|
||||||
|
#include "los_process_pri.h"
|
||||||
|
|
||||||
|
#ifdef LOSCFG_SCHED_DEBUG
|
||||||
|
#ifdef LOSCFG_SCHED_TICK_DEBUG
|
||||||
|
typedef struct {
|
||||||
|
UINT64 responseTime;
|
||||||
|
UINT64 responseTimeMax;
|
||||||
|
UINT64 count;
|
||||||
|
} SchedTickDebug;
|
||||||
|
STATIC SchedTickDebug *g_schedTickDebug = NULL;
|
||||||
|
|
||||||
|
UINT32 OsSchedDebugInit(VOID)
|
||||||
|
{
|
||||||
|
UINT32 size = sizeof(SchedTickDebug) * LOSCFG_KERNEL_CORE_NUM;
|
||||||
|
g_schedTickDebug = (SchedTickDebug *)LOS_MemAlloc(m_aucSysMem0, size);
|
||||||
|
if (g_schedTickDebug == NULL) {
|
||||||
|
return LOS_ERRNO_TSK_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
(VOID)memset_s(g_schedTickDebug, size, 0, size);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID OsSchedDebugRecordData(VOID)
|
||||||
|
{
|
||||||
|
SchedRunQue *rq = OsSchedRunQue();
|
||||||
|
SchedTickDebug *schedDebug = &g_schedTickDebug[ArchCurrCpuid()];
|
||||||
|
UINT64 currTime = OsGetCurrSchedTimeCycle();
|
||||||
|
LOS_ASSERT(currTime >= rq->responseTime);
|
||||||
|
UINT64 usedTime = currTime - rq->responseTime;
|
||||||
|
schedDebug->responseTime += usedTime;
|
||||||
|
if (usedTime > schedDebug->responseTimeMax) {
|
||||||
|
schedDebug->responseTimeMax = usedTime;
|
||||||
|
}
|
||||||
|
schedDebug->count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT32 OsShellShowTickResponse(VOID)
|
||||||
|
{
|
||||||
|
UINT32 intSave;
|
||||||
|
UINT16 cpu;
|
||||||
|
|
||||||
|
UINT32 tickSize = sizeof(SchedTickDebug) * LOSCFG_KERNEL_CORE_NUM;
|
||||||
|
SchedTickDebug *schedDebug = (SchedTickDebug *)LOS_MemAlloc(m_aucSysMem1, tickSize);
|
||||||
|
if (schedDebug == NULL) {
|
||||||
|
return LOS_NOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
SCHEDULER_LOCK(intSave);
|
||||||
|
(VOID)memcpy_s((CHAR *)schedDebug, tickSize, (CHAR *)g_schedTickDebug, tickSize);
|
||||||
|
SCHEDULER_UNLOCK(intSave);
|
||||||
|
|
||||||
|
PRINTK("cpu ATRTime(us) ATRTimeMax(us) TickCount\n");
|
||||||
|
for (cpu = 0; cpu < LOSCFG_KERNEL_CORE_NUM; cpu++) {
|
||||||
|
SchedTickDebug *schedData = &schedDebug[cpu];
|
||||||
|
UINT64 averTime = 0;
|
||||||
|
if (schedData->count > 0) {
|
||||||
|
averTime = schedData->responseTime / schedData->count;
|
||||||
|
averTime = (averTime * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
||||||
|
}
|
||||||
|
UINT64 timeMax = (schedData->responseTimeMax * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
||||||
|
PRINTK("%3u%14llu%15llu%11llu\n", cpu, averTime, timeMax, schedData->count);
|
||||||
|
}
|
||||||
|
|
||||||
|
(VOID)LOS_MemFree(m_aucSysMem1, schedDebug);
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
STATIC VOID SchedDataGet(const LosTaskCB *taskCB, UINT64 *runTime, UINT64 *timeSlice,
|
||||||
|
UINT64 *pendTime, UINT64 *schedWait)
|
||||||
|
{
|
||||||
|
if (taskCB->schedStat.switchCount >= 1) {
|
||||||
|
UINT64 averRunTime = taskCB->schedStat.runTime / taskCB->schedStat.switchCount;
|
||||||
|
*runTime = (averRunTime * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (taskCB->schedStat.timeSliceCount > 1) {
|
||||||
|
UINT64 averTimeSlice = taskCB->schedStat.timeSliceTime / (taskCB->schedStat.timeSliceCount - 1);
|
||||||
|
*timeSlice = (averTimeSlice * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (taskCB->schedStat.pendCount > 1) {
|
||||||
|
UINT64 averPendTime = taskCB->schedStat.pendTime / taskCB->schedStat.pendCount;
|
||||||
|
*pendTime = (averPendTime * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (taskCB->schedStat.waitSchedCount > 0) {
|
||||||
|
UINT64 averSchedWait = taskCB->schedStat.waitSchedTime / taskCB->schedStat.waitSchedCount;
|
||||||
|
*schedWait = (averSchedWait * OS_NS_PER_CYCLE) / OS_SYS_NS_PER_US;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT32 OsShellShowSchedStatistics(VOID)
|
||||||
|
{
|
||||||
|
UINT32 taskLinkNum[LOSCFG_KERNEL_CORE_NUM];
|
||||||
|
UINT32 intSave;
|
||||||
|
LosTaskCB task;
|
||||||
|
|
||||||
|
SCHEDULER_LOCK(intSave);
|
||||||
|
for (UINT16 cpu = 0; cpu < LOSCFG_KERNEL_CORE_NUM; cpu++) {
|
||||||
|
SchedRunQue *rq = OsSchedRunQueByID(cpu);
|
||||||
|
taskLinkNum[cpu] = OsGetSortLinkNodeNum(&rq->taskSortLink);
|
||||||
|
}
|
||||||
|
SCHEDULER_UNLOCK(intSave);
|
||||||
|
|
||||||
|
for (UINT16 cpu = 0; cpu < LOSCFG_KERNEL_CORE_NUM; cpu++) {
|
||||||
|
PRINTK("cpu: %u Task SortMax: %u\n", cpu, taskLinkNum[cpu]);
|
||||||
|
}
|
||||||
|
|
||||||
|
PRINTK(" Tid AverRunTime(us) SwitchCount AverTimeSlice(us) TimeSliceCount AverReadyWait(us) "
|
||||||
|
"AverPendTime(us) TaskName \n");
|
||||||
|
for (UINT32 tid = 0; tid < g_taskMaxNum; tid++) {
|
||||||
|
LosTaskCB *taskCB = g_taskCBArray + tid;
|
||||||
|
SCHEDULER_LOCK(intSave);
|
||||||
|
if (OsTaskIsUnused(taskCB) || (taskCB->processID == OsGetIdleProcessID())) {
|
||||||
|
SCHEDULER_UNLOCK(intSave);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
(VOID)memcpy_s(&task, sizeof(LosTaskCB), taskCB, sizeof(LosTaskCB));
|
||||||
|
SCHEDULER_UNLOCK(intSave);
|
||||||
|
|
||||||
|
UINT64 averRunTime = 0;
|
||||||
|
UINT64 averTimeSlice = 0;
|
||||||
|
UINT64 averPendTime = 0;
|
||||||
|
UINT64 averSchedWait = 0;
|
||||||
|
|
||||||
|
SchedDataGet(&task, &averRunTime, &averTimeSlice, &averPendTime, &averSchedWait);
|
||||||
|
|
||||||
|
PRINTK("%5u%19llu%15llu%19llu%18llu%19llu%18llu %-32s\n", taskCB->taskID,
|
||||||
|
averRunTime, taskCB->schedStat.switchCount,
|
||||||
|
averTimeSlice, taskCB->schedStat.timeSliceCount - 1,
|
||||||
|
averSchedWait, averPendTime, taskCB->taskName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return LOS_OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue