代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/procps-ng 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From e1df029e6c8bb166a6cec05dc12f699d84631bc9 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Sat, 22 Jun 2024 00:00:00 -0500
Subject: [PATCH 1/3] library: implement guest/total tics change, <stat> api
This patch removes guest tics from the total lest they
be counted twice. Such tics have already been included
in user/nice values. For proof, just follow this path:
fs/proc/stat.c: show_stat() --->
kernel/sched/cputime.c: kcpustat_cpu_fetch()
Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/339
. Sep, 2020 - where guest distortion occurred
commit ec21588be108d092804eb72edbba2ba214bc6190
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
library/include/stat.h | 6 +++---
library/stat.c | 12 ++++++++----
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/library/include/stat.h b/library/include/stat.h
index ff7c5b17..d8ca2add 100644
--- a/library/include/stat.h
+++ b/library/include/stat.h
@@ -45,8 +45,8 @@ enum stat_item {
STAT_TIC_IRQ, // ull_int "
STAT_TIC_SOFTIRQ, // ull_int "
STAT_TIC_STOLEN, // ull_int "
- STAT_TIC_GUEST, // ull_int "
- STAT_TIC_GUEST_NICE, // ull_int "
+ STAT_TIC_GUEST, // ull_int " (note: also included in USER)
+ STAT_TIC_GUEST_NICE, // ull_int " (note: also included in NICE)
STAT_TIC_DELTA_USER, // sl_int derived from above
STAT_TIC_DELTA_NICE, // sl_int "
@@ -63,7 +63,7 @@ enum stat_item {
STAT_TIC_SUM_SYSTEM, // ull_int derived from SYSTEM + IRQ + SOFTIRQ tics
STAT_TIC_SUM_IDLE, // ull_int derived from IDLE + IOWAIT tics
STAT_TIC_SUM_BUSY, // ull_int derived from SUM_TOTAL - SUM_IDLE tics
- STAT_TIC_SUM_TOTAL, // ull_int derived from sum of all 10 tics
+ STAT_TIC_SUM_TOTAL, // ull_int derived from sum of all tics, minus 2 GUEST tics
STAT_TIC_SUM_DELTA_USER, // sl_int derived from above
STAT_TIC_SUM_DELTA_SYSTEM, // sl_int "
diff --git a/library/stat.c b/library/stat.c
index 202dfa52..96672431 100644
--- a/library/stat.c
+++ b/library/stat.c
@@ -572,11 +572,15 @@ static inline void stat_derive_unique (
this->new.xidl
= this->new.idle
+ this->new.iowait;
+ /* note: we exclude guest tics from xtot since ...
+ 'user' already includes 'guest'
+ 'nice' already includes 'gnice'
+ ( see linux sources: ./kernel/sched/cputime.c, kcpustat_cpu_fetch ) */
this->new.xtot
- = this->new.xusr + this->new.xsys + this->new.xidl
- + this->new.stolen
- + this->new.guest
- + this->new.gnice;
+ = this->new.xusr
+ + this->new.xsys
+ + this->new.xidl
+ + this->new.stolen;
this->new.xbsy
= this->new.xtot - this->new.xidl;
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。