提交 67ac8c4c 编写于 作者: Z zhushengle

fix: 以g_sysSchedStartTime是否为0判断时间轴是否生效存在极限场景导致调度时间不生效

初始化调度时间不以g_sysSchedStartTime是否为0为界限,而以g_sysSchedStartTime是否为64位最大值
为界限,避免特殊以下场景:调度开启时系统时间为0,导致初始化的g_sysSchedStartTime还是0,导致
调度启动后获取的调度时间轴始终为0.
Close  #I45HP5
Signed-off-by: Nzhushengle <zhushengle@huawei.com>
Change-Id: I5272c79f06b53361ee7b931081d3a3276db59073
上级 1aa9f988
......@@ -56,11 +56,11 @@ extern UINT64 g_sysSchedStartTime;
STATIC INLINE UINT64 OsGetCurrSchedTimeCycle(VOID)
{
if (g_sysSchedStartTime == 0) {
return g_sysSchedStartTime;
if (g_sysSchedStartTime != OS_64BIT_MAX) {
return (HalClockGetCycles() - g_sysSchedStartTime);
}
return (HalClockGetCycles() - g_sysSchedStartTime);
return 0;
}
STATIC INLINE VOID OsSchedIrqUpdateUsedTime(VOID)
......
......@@ -48,7 +48,6 @@
#endif
#define OS_32BIT_MAX 0xFFFFFFFFUL
#define OS_64BIT_MAX 0xFFFFFFFFFFFFFFFFULL
#define OS_SCHED_FIFO_TIMEOUT 0x7FFFFFFF
#define OS_PRIORITY_QUEUE_NUM 32
#define PRIQUEUE_PRIOR0_BIT 0x80000000U
......@@ -73,7 +72,7 @@ typedef struct {
STATIC Sched *g_sched = NULL;
STATIC UINT64 g_schedTickMaxResponseTime;
UINT64 g_sysSchedStartTime = 0;
UINT64 g_sysSchedStartTime = OS_64BIT_MAX;
#ifdef LOSCFG_SCHED_TICK_DEBUG
#define OS_SCHED_DEBUG_DATA_NUM 1000
......@@ -253,7 +252,7 @@ UINT32 OsSchedSetTickTimerType(UINT32 timerType)
STATIC VOID OsSchedSetStartTime(UINT64 currCycle)
{
if (g_sysSchedStartTime == 0) {
if (g_sysSchedStartTime == OS_64BIT_MAX) {
g_sysSchedStartTime = currCycle;
}
}
......@@ -889,7 +888,9 @@ VOID OsSchedStart(VOID)
SCHEDULER_LOCK(intSave);
OsTickStart();
if (cpuid == 0) {
OsTickStart();
}
LosTaskCB *newTask = OsGetTopTask();
LosProcessCB *newProcess = OS_PCB_FROM_PID(newTask->processID);
......
......@@ -188,6 +188,7 @@ typedef size_t BOOL;
#define OS_ERROR (UINT32)(-1)
#define OS_INVALID (UINT32)(-1)
#define OS_INVALID_VALUE ((UINT32)0xFFFFFFFF)
#define OS_64BIT_MAX 0xFFFFFFFFFFFFFFFFULL
#define asm __asm
#ifdef typeof
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册