kernel: Update CPU runtime stats of non-idle time

Updates sched_cpu_update_usage() such that the CPU runtime stats
only update the its non-idle time when the current thread is not the
idle thread. This is necessary as otherwise the CPUs idle-time will
be double counted in k_thread_runtime_stats.execution_cycles.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
Peter Mitsis 2022-01-18 10:17:14 -05:00 committed by Anas Nashif
commit 11f8f6697f

View file

@ -47,7 +47,9 @@ static void sched_cpu_update_usage(struct _cpu *cpu, uint32_t cycles)
} }
#endif #endif
if (cpu->current != cpu->idle_thread) {
cpu->usage.total += cycles; cpu->usage.total += cycles;
}
} }
#else #else
#define sched_cpu_update_usage(cpu, cycles) do { } while (0) #define sched_cpu_update_usage(cpu, cycles) do { } while (0)