diff mbox series

libtraceevent: Do not print message if wakeup success field is missing

Message ID 20210820173559.5644c2b0@oasis.local.home (mailing list archive)
State Accepted
Commit 159f118588739f43f58e7c15f70192cf8d7b9ace
Headers show
Series libtraceevent: Do not print message if wakeup success field is missing | expand

Commit Message

Steven Rostedt Aug. 20, 2021, 9:35 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The "success" field for sched wakeup has been hardcoded as "1" for years
now, because it is no longer anything but successful. The sched wakeup
plugin had the "err" parameter of tep_get_field_val() backwards, where it
had no message for fields it expects to see, but will show a error message
for the success field, which may not be there.

Fixes: 4f6857aa ("tools lib traceevent: Add sched_switch plugin")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 plugins/plugin_sched_switch.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/plugins/plugin_sched_switch.c b/plugins/plugin_sched_switch.c
index e12fa10..73145ff 100644
--- a/plugins/plugin_sched_switch.c
+++ b/plugins/plugin_sched_switch.c
@@ -67,13 +67,13 @@  static int sched_wakeup_handler(struct trace_seq *s,
 	}
 	trace_seq_printf(s, "%lld", val);
 
-	if (tep_get_field_val(s, event, "prio", record, &val, 0) == 0)
+	if (tep_get_field_val(s, event, "prio", record, &val, 1) == 0)
 		trace_seq_printf(s, " [%lld]", val);
 
-	if (tep_get_field_val(s, event, "success", record, &val, 1) == 0)
+	if (tep_get_field_val(s, event, "success", record, &val, 0) == 0)
 		trace_seq_printf(s, " success=%lld", val);
 
-	if (tep_get_field_val(s, event, "target_cpu", record, &val, 0) == 0)
+	if (tep_get_field_val(s, event, "target_cpu", record, &val, 1) == 0)
 		trace_seq_printf(s, " CPU:%03llu", val);
 
 	return 0;
@@ -96,10 +96,10 @@  static int sched_switch_handler(struct trace_seq *s,
 	}
 	trace_seq_printf(s, "%lld ", val);
 
-	if (tep_get_field_val(s, event, "prev_prio", record, &val, 0) == 0)
+	if (tep_get_field_val(s, event, "prev_prio", record, &val, 1) == 0)
 		trace_seq_printf(s, "[%d] ", (int) val);
 
-	if (tep_get_field_val(s,  event, "prev_state", record, &val, 0) == 0)
+	if (tep_get_field_val(s,  event, "prev_state", record, &val, 1) == 0)
 		write_state(s, val);
 
 	trace_seq_puts(s, " ==> ");
@@ -114,7 +114,7 @@  static int sched_switch_handler(struct trace_seq *s,
 	}
 	trace_seq_printf(s, "%lld", val);
 
-	if (tep_get_field_val(s, event, "next_prio", record, &val, 0) == 0)
+	if (tep_get_field_val(s, event, "next_prio", record, &val, 1) == 0)
 		trace_seq_printf(s, " [%d]", (int) val);
 
 	return 0;