diff mbox series

[06/17] kernel-shark-qt: Ignore sched_wakeup events if the task is running.

Message ID 20181128151530.21965-7-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Commit f45df413d1aee27470e16e67fcd5be7cc11f8243
Headers show
Series More modifications and bug fixes toward KS 1.0 | expand

Commit Message

Yordan Karadzhov Nov. 28, 2018, 3:16 p.m. UTC
The "Sched Events" plugin uses the sched_wakeup events to visualize
the wake up latency of the task. This patch deals with the corner
case, when we have a second sched_wakeup events which tries to wake
up a task which is already running.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/plugins/SchedEvents.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/kernel-shark-qt/src/plugins/SchedEvents.cpp b/kernel-shark-qt/src/plugins/SchedEvents.cpp
index b4596c9..ea07662 100644
--- a/kernel-shark-qt/src/plugins/SchedEvents.cpp
+++ b/kernel-shark-qt/src/plugins/SchedEvents.cpp
@@ -139,6 +139,21 @@  static void pluginDraw(plugin_sched_context *plugin_ctx,
 				ksmodel_get_entry_back(histo, bin, false,
 						       plugin_wakeup_match_rec_pid,
 						       pid, col, &indexOpen);
+
+			if (entryOpen) {
+				int cpu = ksmodel_get_cpu_back(histo, bin,
+								      pid,
+								      false,
+								      col,
+								      nullptr);
+				if (cpu >= 0) {
+					/*
+					 * The task is already running. Ignore
+					 * this wakeup event.
+					 */
+					entryOpen = nullptr;
+				}
+			}
 		}
 
 		if (rec) {