From 0ce996226962b9a43b4064eca0d495b038c94ab7 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Wed, 15 Jun 2022 00:00:00 -0500 Subject: [PATCH] top: raise %CPU maximum if large numbers of processors <=== port of newlib 7279cd8e ______________________________ original newlib message 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 ce32616d..ec3dd30a 100644 --- a/top/top.c +++ b/top/top.c @@ -2511,7 +2511,11 @@ static void zap_fieldstab (void) { Cpu_pmax = 99.9; if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) { Cpu_pmax = 100.0 * smp_num_cpus; - if (smp_num_cpus > 10) { + if (smp_num_cpus > 1000) { + if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0; + } else if (smp_num_cpus > 100) { + if (smp_num_cpus > 999999.0) Cpu_pmax = 999999.0; + } else if (smp_num_cpus > 10) { if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0; } else { if (Cpu_pmax > 999.9) Cpu_pmax = 999.9;