On Mon, Jan 07, 2013 at 05:58:43PM +0400, Vadim Zhukov wrote:
> Small nit that allows (immediately) differentiate "processes" and
> "threads" output of top(1). Adds another dependency on "machine.h",
> though. :( Tested on both smart and dumb terminals. Any comments/okays?
> 
> --
>   WBR,
>   Vadim Zhukov
> 
> 
> Index: display.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/top/display.c,v
> retrieving revision 1.43
> diff -u -p -r1.43 display.c
> --- display.c 5 Jun 2012 18:52:53 -0000       1.43
> +++ display.c 7 Jan 2013 13:50:38 -0000
> @@ -100,6 +100,7 @@ int y_idlecursor;
>  int y_procs;
>  extern int ncpu;
>  extern int combine_cpus;
> +extern struct process_select ps;
>  
>  int header_status = Yes;
>  
> @@ -275,15 +276,18 @@ i_procstates(int total, int *brkdn)
>  
>               move(1, 0);
>               clrtoeol();
> -             /* write current number of processes and remember the value */
> -             printwp("%d processes:", total);
> +             /* write current number of procs and remember the value */
> +             if (ps.threads == Yes)
> +                     printwp("%d threads:", total);
> +             else
> +                     printwp("%d processes:", total);
>  
>               if (smart_terminal)
>                       move(1, 15);
>               else {
>                       /* put out enough spaces to get to column 15 */
>                       i = digits(total);
> -                     while (i++ < 4) {
> +                     while (i++ < (ps.threads == Yes ? 6 : 4)) {
>                               if (putchar(' ') == EOF)
>                                       exit(1);
>                       }
I like that.

guenther, any objection ?

Reply via email to