提交 e1472b49 编写于 作者: O openharmony_ci 提交者: Gitee

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

Merge pull request !548 from zhushengle/sched_time
......@@ -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.
先完成此消息的编辑!
想要评论请 注册