diff options
author | Vladimir Panteleev <git@thecybershadow.net> | 2018-01-14 09:08:20 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-02-04 16:44:21 +0100 |
commit | 87be623eac49676ef0ac8e95733308dc12e37582 (patch) | |
tree | bc1b21599a7258865b2eb1800da791b11fe32745 /Process.c | |
parent | b27712181aa27ae1e993f1a505c8e3717e709244 (diff) |
Add support for Linux TASK_IDLE
Linux commit 06eb61844d841d0032a9950ce7f8e783ee49c0d0 ("sched/debug:
Add explicit TASK_IDLE printing") exposes kthreads idling using
TASK_IDLE in procfs as "I (idle)".
Until now, when sorting the STATE ("S") column, htop used the raw
value of the state character for comparison, however that led to the
undesirable effect of TASK_IDLE ('I') tasks being sorted above tasks
that were running ('R').
Thus, explicitly recognize the idle process state, and sort it below
others.
Diffstat (limited to 'Process.c')
-rw-r--r-- | Process.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -174,6 +174,8 @@ typedef struct ProcessClass_ { #define Process_isChildOf(process_, pid_) (process_->tgid == pid_ || (process_->tgid == process_->pid && process_->ppid == pid_)) +#define Process_sortState(state) ((state) == 'I' ? 0x100 : (state)) + }*/ static int Process_getuid = -1; @@ -598,7 +600,7 @@ long Process_compare(const void* v1, const void* v2) { return (p1->starttime_ctime - p2->starttime_ctime); } case STATE: - return (p1->state - p2->state); + return (Process_sortState(p1->state) - Process_sortState(p2->state)); case ST_UID: return (p1->st_uid - p2->st_uid); case TIME: |