library: account for idle state ('I') threads in total

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 91df65b9e7

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2018-01-13 00:00:00 -06:00 committed by Craig Small
parent 264790d80d
commit 7ede9ef79f
2 changed files with 9 additions and 3 deletions

View 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;

View 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 {