]> granicus.if.org Git - procps-ng/commitdiff
library: account for idle state ('I') threads in total
authorJim Warner <james.warner@comcast.net>
Sat, 13 Jan 2018 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@enc.com.au>
Mon, 12 Feb 2018 09:58:31 +0000 (20:58 +1100)
With the documentation update in the commit referenced
below, we should also account for such threads as they
will already be represented in the task/thread totals.

[ and do it in a way that might avoid future changes ]

Reference(s):
commit 91df65b9e778b9d7da7952d766e129f58423b807

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/pids.c
proc/pids.h

index 0ee66b39fdc4ba13af75b0d2d1fddb5b76992fca..5f9ea1e8709811cc1f30cb84d4ecdf2e4836c964 100644 (file)
@@ -961,17 +961,23 @@ static inline int pids_proc_tally (
         case 'R':
             ++counts->running;
             break;
+        case 'D':      // 'D' (disk sleep)
         case 'S':
-        case 'D':
             ++counts->sleeping;
             break;
+        case 't':      // 't' (tracing stop)
         case 'T':
             ++counts->stopped;
             break;
         case 'Z':
             ++counts->zombied;
             break;
-        default:                // keep gcc happy
+        default:
+            /* currently: 'I' (idle),
+                          'P' (parked),
+                          'X' (dead - actually 'dying' & probably never seen)
+            */
+            ++counts->other;
             break;
     }
     ++counts->total;
index 8fb489d15dae206ec960b77c83c37084a99246a1..96635b1d0f56cdf533878ddb90cd234178092b34 100644 (file)
@@ -183,7 +183,7 @@ struct pids_stack {
 
 struct pids_counts {
     int total;
-    int running, sleeping, stopped, zombied;
+    int running, sleeping, stopped, zombied, other;
 };
 
 struct pids_fetch {