diff mbox series

[05/11] libtraceeval task-eval: Account for ZOMBIE and EXITED states

Message ID 20231011032640.1804571-6-rostedt@goodmis.org (mailing list archive)
State Under Review
Headers show
Series libtraceeval task-eval: Updates to evaluate tasks | expand

Commit Message

Steven Rostedt Oct. 11, 2023, 3:25 a.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Currently, if a sched_switch happens with a task in he ZOMBIE or EXITED
state, task-eval will treat it as being preempted in a running state. This
is incorrect, and should be updated to reflect it.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 samples/task-eval.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/samples/task-eval.c b/samples/task-eval.c
index 40e7345a27c4..061d27374e66 100644
--- a/samples/task-eval.c
+++ b/samples/task-eval.c
@@ -254,6 +254,8 @@  enum sched_state {
 	PREEMPT,
 	SLEEP,
 	IDLE,
+	ZOMBIE,
+	EXITED,
 	OTHER
 };
 
@@ -474,6 +476,10 @@  static int get_stop_state(unsigned long long val)
 		return SLEEP;
 	if (val & 2)
 		return BLOCKED;
+	if (val & 0x10)
+		return ZOMBIE;
+	if (val & 0x20)
+		return EXITED;
 	return PREEMPT;
 }