tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

top(1) diff to use all available column space



Hello, tech-userlevel@!

Here's a top diff which makes it less annoying when stretching
the x terminal screen.

I also swapped name and command fields in thread view
so long command name can take all available space in the end.
(lwp->l_name space is shrunk a bit too, but nobody will get hurt
i guess).

This makes top adorable especially when running as `top -ct` (i usually
do so).

Index: dist/machine/m_netbsd.c
===================================================================
RCS file: /cvsroot/src/external/bsd/top/dist/machine/m_netbsd.c,v
retrieving revision 1.14
diff -u -p -r1.14 m_netbsd.c
--- dist/machine/m_netbsd.c     31 May 2010 18:14:59 -0000      1.14
+++ dist/machine/m_netbsd.c     13 Apr 2011 13:38:20 -0000
@@ -105,14 +105,14 @@ static char Proc_header[] =
 /* 0123456   -- field to fill in starts at header+6 */
 #define PROC_UNAME_START 6
 #define Proc_format \
-       "%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.*f%% %5.*f%% %.12s"
+       "%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.*f%% %5.*f%% %s"
 
 static char Thread_header[] =
-  "  PID   LID X        PRI STATE      TIME   WCPU    CPU COMMAND      NAME";
+  "  PID   LID X        PRI STATE      TIME   WCPU    CPU NAME      COMMAND";
 /* 0123456   -- field to fill in starts at header+6 */
 #define THREAD_UNAME_START 12
 #define Thread_format \
-        "%5d %5d %-8.8s %3d %-8.8s%7s %5.2f%% %5.2f%% %-12.12s %.12s"
+        "%5d %5d %-8.8s %3d %-8.8s%7s %5.2f%% %5.2f%% %-9.9s %s"
 
 /* 
  * Process state names for the "STATE" column of the display.
@@ -939,8 +939,8 @@ format_next_lwp(caddr_t handle, char *(*
            format_time(cputime),
            100.0 * weighted_cpu(l_, pct, pl),
            100.0 * pct,
-           get_command(hp->sel, pp),
-           printable(pl->l_name));
+           printable(pl->l_name),
+           get_command(hp->sel, pp));
 
        /* return the result */
        return(fmt);


Home | Main Index | Thread Index | Old Index