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 <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2022-04-09 00:00:00 -05:00 committed by Craig Small
parent 6aec3ec93a
commit 7279cd8e4d

View File

@ -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;