File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Ports/ARM-Cortex-M/ARMv7-M Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -513,8 +513,10 @@ void OSTaskSwHook (void)
513513#if OS_CFG_TASK_PROFILE_EN > 0u
514514 ts = OS_TS_GET ();
515515 if (OSTCBCurPtr != OSTCBHighRdyPtr ) {
516- OSTCBCurPtr -> CyclesDelta = ts - OSTCBCurPtr -> CyclesStart ;
517- OSTCBCurPtr -> CyclesTotal += (OS_CYCLES )OSTCBCurPtr -> CyclesDelta ;
516+ if (ts > OSTCBCurPtr -> CyclesStart ) {
517+ OSTCBCurPtr -> CyclesDelta = ts - OSTCBCurPtr -> CyclesStart ;
518+ OSTCBCurPtr -> CyclesTotal += (OS_CYCLES )OSTCBCurPtr -> CyclesDelta ;
519+ }
518520 }
519521
520522 OSTCBHighRdyPtr -> CyclesStart = ts ;
Original file line number Diff line number Diff line change @@ -272,6 +272,18 @@ void OSIntEnter (void)
272272 return ; /* Yes */
273273 }
274274
275+ #if OS_CFG_TASK_PROFILE_EN > 0u
276+ if (OSIntNestingCtr == 0 ) {
277+ CPU_TS ts ;
278+
279+ ts = OS_TS_GET ();
280+ if (ts > OSTCBCurPtr -> CyclesStart ) {
281+ OSTCBCurPtr -> CyclesDelta = ts - OSTCBCurPtr -> CyclesStart ;
282+ OSTCBCurPtr -> CyclesTotal += (OS_CYCLES )OSTCBCurPtr -> CyclesDelta ;
283+ }
284+ }
285+ #endif
286+
275287 OSIntNestingCtr ++ ; /* Increment ISR nesting level */
276288}
277289
@@ -339,6 +351,10 @@ void OSIntExit (void)
339351#endif
340352#endif
341353
354+ #if OS_CFG_TASK_PROFILE_EN > 0u
355+ OSTCBCurPtr -> CyclesStart = OS_TS_GET ();
356+ #endif
357+
342358 OSPrioHighRdy = OS_PrioGetHighest (); /* Find highest priority */
343359#if (OS_CFG_TASK_IDLE_EN > 0u )
344360 OSTCBHighRdyPtr = OSRdyList [OSPrioHighRdy ].HeadPtr ; /* Get highest priority task ready-to-run */
You can’t perform that action at this time.
0 commit comments