Skip to content

Commit 11f8f66

Browse files
peter-mitsisnashif
authored andcommitted
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 <[email protected]>
1 parent 019a1e1 commit 11f8f66

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

kernel/usage.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ static void sched_cpu_update_usage(struct _cpu *cpu, uint32_t cycles)
4747
}
4848
#endif
4949

50-
cpu->usage.total += cycles;
50+
if (cpu->current != cpu->idle_thread) {
51+
cpu->usage.total += cycles;
52+
}
5153
}
5254
#else
5355
#define sched_cpu_update_usage(cpu, cycles) do { } while (0)

0 commit comments

Comments
 (0)