Package: procps Version: 1:3.2.7-3 Severity: normal Tags: patch Hi,
When Irix mode is enabled, the format for %CPU is %4.0f since we need to show more than 100%. However, when threads are shown (H), we don't need any more since a single thread can't use more than 100% of a single CPU. The attached patch thus makes use of format %4.0f only when Irix mode is enabled and threads are not shown. -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (900, 'testing'), (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.20-1-686-bigmem (SMP w/2 CPU cores) Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15) Shell: /bin/sh linked to /bin/bash Versions of packages procps depends on: ii libc6 2.7-5 GNU C Library: Shared libraries ii libncurses5 5.6+20071215-1 Shared libraries for terminal hand ii lsb-base 3.1-23.1 Linux Standard Base 3.1 init scrip Versions of packages procps recommends: ii psmisc 22.5-1 Utilities that use the proc filesy -- no debconf information -- Samuel Thibault <[EMAIL PROTECTED]>
--- top.c.orig 2008-01-02 02:20:16.000000000 +0100 +++ top.c 2008-01-02 02:25:02.000000000 +0100 @@ -1774,7 +1774,8 @@ confighlp(Winstk[i].rc.fieldscur); } - if(Rc.mode_irixps && smp_num_cpus>1){ + if(Rc.mode_irixps && smp_num_cpus>1 && + !(CHKw(Curwin, Show_THREADS))) { // good for 100 CPUs per process pcpu_max_value = 9999.0; Fieldstab[P_CPU].fmts = " %4.0f"; @@ -2561,6 +2562,15 @@ case 'H': if (VIZCHKc) { TOGw(Curwin, Show_THREADS); + if(Rc.mode_irixps && smp_num_cpus>1 && + !(CHKw(Curwin, Show_THREADS))){ + // good for 100 CPUs per process + pcpu_max_value = 9999.0; + Fieldstab[P_CPU].fmts = " %4.0f"; + } else { + pcpu_max_value = 99.9; + Fieldstab[P_CPU].fmts = " %#4.1f"; + } show_msg(fmtmk("Show threads %s" , CHKw(Curwin, Show_THREADS) ? "On" : "Off")); } @@ -2617,7 +2627,8 @@ Rc.mode_irixps = !Rc.mode_irixps; show_msg(fmtmk("Irix mode %s", Rc.mode_irixps ? "On" : "Off")); #endif - if(Rc.mode_irixps && smp_num_cpus>1){ + if(Rc.mode_irixps && smp_num_cpus>1 && + !(CHKw(Curwin, Show_THREADS))){ // good for 100 CPUs per process pcpu_max_value = 9999.0; Fieldstab[P_CPU].fmts = " %4.0f";