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

Merge pull request !548 from zhushengle/sched_time
This commit is contained in:
openharmony_ci 2021-08-14 06:23:33 +00:00 committed by Gitee
commit e1472b494f
3 changed files with 9 additions and 7 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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