ps - Show cpu# even when process is sleeping
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 21 Sep 2012 23:05:50 +0000 (16:05 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 21 Sep 2012 23:05:50 +0000 (16:05 -0700)
* Show the cpu# the process is scheduled on even when it is sleeping.

* Add a 'Q' flag for 'R'unnable processes, indicating that it is runnable
  but on the user scheduler runq and does not actually have cpu at the
  moment.

bin/ps/print.c

index c3e5a04..93e836d 100644 (file)
@@ -210,11 +210,16 @@ state(const KINFO *k, const struct varent *vent)
                                *cp = 'D';      /* uninterruptable wait */
                        else
                                *cp = 'B';      /* uninterruptable lwkt wait */
-                       break;
+                       /*break;*/
 
                case LSRUN:
-                       *cp = 'R';
-                       if (KI_LWP(k, tdflags) & (TDF_RUNNING | TDF_RUNQ)) {
+                       if (KI_LWP(k, stat) == LSRUN) {
+                               *cp = 'R';
+                               if (!(KI_LWP(k, tdflags) &
+                                   (TDF_RUNNING | TDF_RUNQ)))
+                                       *++cp = 'Q';
+                       }
+                       /*if (KI_LWP(k, tdflags) & (TDF_RUNNING | TDF_RUNQ))*/ {
                            ++cp;
                            sprintf(cp, "%d", KI_LWP(k, cpuid));
                            while (cp[1])