Add more states from /proc/[pid]/stat
from man 5 proc on /proc/[pid]/stat, we see:
(3) state %c
One of the following characters, indicating process state:
R Running
S Sleeping in an interruptible wait
D Waiting in uninterruptible disk sleep
Z Zombie
T Stopped (on a signal) or (before Linux 2.6.33) trace stopped
t Tracing stop (Linux 2.6.33 onward)
W Paging (only before Linux 2.6.0)
X Dead (from Linux 2.6.0 onward)
x Dead (Linux 2.6.33 to 3.13 only)
K Wakekill (Linux 2.6.33 to 3.13 only)
W Waking (Linux 2.6.33 to 3.13 only)
P Parked (Linux 3.9 to 3.13 only)
I Idle (Linux 4.14 onward)
Of the states there, 't' and 'X' are the only ones missing, so add them.
I hit these when strace'ing a test.
Change-Id: I3048e82fc5265c1f701538ae209183ecf8a961be
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/util/top.cc b/aos/util/top.cc
index 10ebd4d..8a78609 100644
--- a/aos/util/top.cc
+++ b/aos/util/top.cc
@@ -209,6 +209,10 @@
return ThreadState::ZOMBIE;
case 'I':
return ThreadState::IDLE;
+ case 'X':
+ return ThreadState::DEAD;
+ case 't':
+ return ThreadState::TRACING_STOP;
default:
LOG(FATAL) << "Invalid thread state character: " << state;
}