From 7279cd8e4d21f8fab62e34e4695b46e86cba2442 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sat, 9 Apr 2022 00:00:00 -0500 Subject: [PATCH] top: raise %CPU maximum if large numbers of processors It would appear that openSUSE was the first to release procps-ng version 4.0.0 (in the tumbleweed distro). As a result I checked their source rpm and found a couple of patches I'm porting to newlib for the next release. This particulate patch, with some changes, is openSUSE patch 'procps-ng-3.3.10-large_pcpu.patch'. The changes were strictly cosmetic. They involved whitespace only. [ it should be noted that the net effect for raising ] [ the maximum is to produce a '?' in the %CPU field. ] [ that's because its width is fixed at five columns. ] [ but at least the '?' won't distort actual results. ] Signed-off-by: Jim Warner --- top/top.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/top/top.c b/top/top.c index 40391f68..b44aecfc 100644 --- a/top/top.c +++ b/top/top.c @@ -2457,7 +2457,11 @@ static void zap_fieldstab (void) { Cpu_pmax = 99.9; if (Rc.mode_irixps && Cpu_cnt > 1 && !Thread_mode) { Cpu_pmax = 100.0 * Cpu_cnt; - if (Cpu_cnt > 10) { + if (Cpu_cnt > 1000) { + if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0; + } else if (Cpu_cnt > 100) { + if (Cpu_cnt > 999999.0) Cpu_pmax = 999999.0; + } else if (Cpu_cnt > 10) { if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0; } else { if (Cpu_pmax > 999.9) Cpu_pmax = 999.9;