diff mbox series

kernel-shark-qt: Don't use collection when searching for sched_wakeup

Message ID 20181129145600.8803-2-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Commit e3bde9fd23c18e582197dd9b167bee43d5292eb5
Headers show
Series kernel-shark-qt: Don't use collection when searching for sched_wakeup | expand

Commit Message

Yordan Karadzhov Nov. 29, 2018, 2:56 p.m. UTC
This patch modifies the way the wake up latency is plotted by
the Sched events plugin. The sched_wakeup event does not belong to
the task it is waking, hence we cannot use the task's collection
to search for it. It was partially working so far because in most
of the cases the sched_wakeup event happened to be inside the
"margins" of the collection. Note that if we do not use collection
when searching, the time complexity of the plugin becomes linear.
However, this should not be a problem, because we have an explicit
cut which disables plotting if the number of entries shown by
the graph is bigger than PLUGIN_MAX_ENTRIES (10 000).

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

Patch

diff --git a/kernel-shark-qt/src/plugins/SchedEvents.cpp b/kernel-shark-qt/src/plugins/SchedEvents.cpp
index ea07662..c8dc3bf 100644
--- a/kernel-shark-qt/src/plugins/SchedEvents.cpp
+++ b/kernel-shark-qt/src/plugins/SchedEvents.cpp
@@ -122,7 +122,7 @@  static void pluginDraw(plugin_sched_context *plugin_ctx,
 			/*
 			 * Starting from the last element in this bin, go backward
 			 * in time until you find a trace entry that satisfies the
-			 * condition defined by plugin_switch_match_pid.
+			 * condition defined by plugin_switch_match_rec_pid.
 			 */
 			entryOpen =
 				ksmodel_get_entry_back(histo, bin, false,
@@ -133,12 +133,16 @@  static void pluginDraw(plugin_sched_context *plugin_ctx,
 			/*
 			 * Starting from the last element in this bin, go backward
 			 * in time until you find a trace entry that satisfies the
-			 * condition defined by plugin_wakeup_match_pid.
+			 * condition defined by plugin_wakeup_match_rec_pid. Note
+			 * that the wakeup event does not belong to this task,
+			 * hence we cannot use the task's collection.
 			 */
 			entryOpen =
 				ksmodel_get_entry_back(histo, bin, false,
 						       plugin_wakeup_match_rec_pid,
-						       pid, col, &indexOpen);
+						       pid,
+						       nullptr, // No collection.
+						       &indexOpen);
 
 			if (entryOpen) {
 				int cpu = ksmodel_get_cpu_back(histo, bin,