Not sure if useful to anyone else, but here it goes a patch that adds a new
column to top, showing the last CPUID where a process has been seen.  Other
top implementations have this feature, which can be useful on some
situations.

Solution may not be very elegant, but it was the one which required less
code churn.  I may work on other solution if there is interest on having
this merged.


diff -u -r1.64 machine.c
--- machine.c   28 Apr 2009 21:24:41 -0000      1.64
+++ machine.c   4 Dec 2009 22:53:39 -0000
@@ -69,13 +69,13 @@
  *  These definitions control the format of the per-process area
  */
 static char header[] =
-       "  PID X        PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU 
COMMAND";
+       "  PID X        PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU #C 
COMMAND";
 
 /* 0123456   -- field to fill in starts at header+6 */
 #define UNAME_START 6
 
 #define Proc_format \
-       "%5d %-8.8s %3d %4d %5s %5s %-9s %-7.7s %6s %5.2f%% %s"
+       "%5d %-8.8s %3d %4d %5s %5s %-9s %-7.7s %6s %5.2f%% %2d %s"
 
 /* process state names for the "STATE" column of the display */
 /*
@@ -496,7 +496,7 @@
            (pp->p_stat == SSLEEP && pp->p_slptime > maxslp) ?
            "idle" : state_abbr(pp),
            p_wait, format_time(cputime), 100.0 * pct,
-           printable(format_comm(pp)));
+           pp->p_cpuid, printable(format_comm(pp)));
 
        *pid = pp->p_pid;
        /* return the result */

Reply via email to