linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel-shark: Handle traces with sched_wakeup but not sched_waking
@ 2021-09-23 14:06 John Keeping
  2021-09-27  9:56 ` Yordan Karadzhov
  0 siblings, 1 reply; 2+ messages in thread
From: John Keeping @ 2021-09-23 14:06 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Yordan Karadzhov, John Keeping

If sched_wakeup or sched_wakeup_new is avaiable but sched_waking is not,
then define_wakeup_event() returns true even though waking_event_ptr is
null.

Change find_wakeup_event() to avoid overwriting the output parameter on
error so that the define_wakeup_event() returns true iff
*waking_event_ptr is non-null.

Signed-off-by: John Keeping <john@metanate.com>
---
 src/libkshark-tepdata.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/libkshark-tepdata.c b/src/libkshark-tepdata.c
index 865ca82..9740ed9 100644
--- a/src/libkshark-tepdata.c
+++ b/src/libkshark-tepdata.c
@@ -1868,9 +1868,14 @@ int kshark_tep_find_top_stream(struct kshark_context *kshark_ctx,
 static bool find_wakeup_event(struct tep_handle *tep, const char *wakeup_name,
 			      struct tep_event **waking_event_ptr)
 {
-	*waking_event_ptr = tep_find_event_by_name(tep, "sched", wakeup_name);
+	struct tep_event *event;
+
+	event = tep_find_event_by_name(tep, "sched", wakeup_name);
+
+	if (event)
+		*waking_event_ptr = event;
 
-	return (*waking_event_ptr)? true : false;
+	return !!event;
 }
 
 /**
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-27  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 14:06 [PATCH] kernel-shark: Handle traces with sched_wakeup but not sched_waking John Keeping
2021-09-27  9:56 ` Yordan Karadzhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).