[PATCH openEuler-21.09 0/2] Improve the precisoin of accounuting CPU utilization rate

The current way of calculating the CPU utilization rate is not accurate. The accounting system only works In the interval of two ticks. However, a process can give up the CPU before the tick ending. This can be fixed by counting the idel time via the scheduler. We can use the sum_exe_runtime of the idle process of each CPU to calculate the the CPU utilization rate. The idle time of each CPU is given in the /proc/stat2 file. An example of using this file is also attached. Hongyu Li (2): eulerfs: add the /proc/stat2 file. tools: add a tool to calculate the idle rate fs/proc/Kconfig | 7 +++ fs/proc/Makefile | 1 + fs/proc/stat2.c | 91 +++++++++++++++++++++++++++++++++++++ kernel/sched/cputime.c | 34 ++++++++++++++ kernel/sched/idle.c | 28 ++++++++++++ tools/accounting/Makefile | 2 +- tools/accounting/idle_cal.c | 91 +++++++++++++++++++++++++++++++++++++ 7 files changed, 253 insertions(+), 1 deletion(-) create mode 100644 fs/proc/stat2.c create mode 100644 tools/accounting/idle_cal.c -- 2.17.1
-
Hongyu Li