mirror of
https://github.com/apache/nuttx.git
synced 2026-09-09 02:16:35 +00:00
sched/critmonitor: Restore the target run start time.
The context-switch merge assigned the current timestamp to run_time instead of run_start. This overwrote the accumulated runtime and left the next elapsed-time calculation with a stale start value when critical-monitor CPU load accounting was disabled.
Store the timestamp in run_start under the thread runtime monitor configuration, matching the former resume path.
Fixes: b2a69ba781 ("sched: merge nxsched_suspend/resume_critmon")
Assisted-by: OpenAI Codex
Signed-off-by: yushuailong <yyyusl@qq.com>
This commit is contained in:
parent
23d2eb96f3
commit
170d02da21
1 changed files with 1 additions and 2 deletions
|
|
@ -377,12 +377,11 @@ void nxsched_switch_critmon(FAR struct tcb_s *from, FAR struct tcb_s *to)
|
|||
clock_t tick = elapsed * CLOCKS_PER_SEC / perf_getfreq();
|
||||
|
||||
nxsched_critmon_cpuload(from, current, tick);
|
||||
to->run_start = current;
|
||||
#endif
|
||||
|
||||
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0
|
||||
from->run_time += elapsed;
|
||||
to->run_time = current;
|
||||
to->run_start = current;
|
||||
if (elapsed > from->run_max)
|
||||
{
|
||||
from->run_max = elapsed;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue