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@xxxxxxxxxx> --- kernel-shark-qt/src/plugins/SchedEvents.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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, -- 2.17.1