[PATCH] display ST when using ps -l

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Dave,

I was recommended to add the display of ST when using ps -l. Because it
is simple, so I made the patch at first and then talk about the merit of
patch with you.

The display is like below:

crash> ps -l
[100126284069406]  PID: 2389   TASK: ffff88047416aa80  ST:IN  CPU: 12
COMMAND: "kondemand/12"
[100126285814043]  PID: 795    TASK: ffff880470cb3540  ST:UN  CPU: 0
COMMAND: "jbd2/sda2-8"
[100126284061076]  PID: 2377   TASK: ffff88047426c100  ST:IN  CPU: 0
COMMAND: "kondemand/0"
[100126284058337]  PID: 70050  TASK: ffff88045beaeac0  ST:RU  CPU: 3
COMMAND: "crash"
[100126285834369]  PID: 70781  TASK: ffff88046929e100  ST:RU  CPU: 0
COMMAND: "dd"
...

I think "ps -l", which displays task sorted by last_run/timestamp, is
concerning about the state of the task. Taking it into consideration, on
a live system with original code, we use "ps -l" to show the sorted
tasks at first, then use "ps" to display the state. The two pieces of
information in such situation are not consonant. This is the reason why
ST is needed.

-- 
--
Regards
Qiao Nuohan

diff --git a/task.c b/task.c
index fde86eb..9e95b83 100755
--- a/task.c
+++ b/task.c
@@ -5770,10 +5770,12 @@ print_task_header(FILE *out, struct task_context *tc, int newline)
 {
 	char buf[BUFSIZE];
 	char buf1[BUFSIZE];
+	char buf2[BUFSIZE];
 
-        fprintf(out, "%sPID: %-5ld  TASK: %s  CPU: %-2s  COMMAND: \"%s\"\n",
+        fprintf(out, "%sPID: %-5ld  TASK: %s  ST:%s  CPU: %-2s  COMMAND: \"%s\"\n",
 		newline ? "\n" : "", tc->pid, 
 		mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX, MKSTR(tc->task)),
+		task_state_string(tc->task, buf2, !VERBOSE),
 		task_cpu(tc->processor, buf, !VERBOSE), tc->comm);
 }
 
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux