mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-18 19:00:36 +08:00
Fix task load measurement in NuttX. Reported by @chungkim. Fixes #5645.
This commit is contained in:
@@ -142,12 +142,14 @@ void sched_note_switch(FAR struct tcb_s *pFromTcb, FAR struct tcb_s *pToTcb)
|
||||
uint8_t both_found = 0;
|
||||
|
||||
for (int i = 0; i < CONFIG_MAX_TASKS; i++) {
|
||||
/* Check if task is initialized correctly */
|
||||
if (system_load.tasks[i].tcb == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Task ending its current scheduling run */
|
||||
if (system_load.tasks[i].tcb->pid == pFromTcb->pid) {
|
||||
//if (system_load.tasks[i].curr_start_time != 0)
|
||||
{
|
||||
system_load.tasks[i].total_runtime += new_time - system_load.tasks[i].curr_start_time;
|
||||
}
|
||||
system_load.tasks[i].total_runtime += new_time - system_load.tasks[i].curr_start_time;
|
||||
both_found++;
|
||||
|
||||
} else if (system_load.tasks[i].tcb->pid == pToTcb->pid) {
|
||||
|
||||
Reference in New Issue
Block a user