Handle the case when task is active in the Lower Overflow bin and the sched_switch event that close the task graph happens to be in bin 0. Fixes: ba206aaa45 ("kernel-shark-qt: Add C++ API for drawing of Graphs") Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx> --- kernel-shark/src/KsPlotTools.cpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/kernel-shark/src/KsPlotTools.cpp b/kernel-shark/src/KsPlotTools.cpp index 816fa56..f97c6e4 100644 --- a/kernel-shark/src/KsPlotTools.cpp +++ b/kernel-shark/src/KsPlotTools.cpp @@ -1020,16 +1020,26 @@ void Graph::fillTaskGraph(int pid) if (cpuFront >= 0) { /* * The Lower Overflow Bin contains data from this Task. - * Now look again in the Lower Overflow Bin and find - * the Pid of the last active task on the same CPU. + * Now look again in the Lower Overflow Bin and Bim 0 + * and find the Pid of the last active task on the same + * CPU. */ - int pidCpu = ksmodel_get_pid_back(_histoPtr, - LOWER_OVERFLOW_BIN, - cpuFront, - false, - _collectionPtr, - nullptr); - if (pidCpu == pid) { + int pidCpu0, pidCpuLOB; + + pidCpu0 = ksmodel_get_pid_back(_histoPtr, + 0, + cpuFront, + false, + _collectionPtr, + nullptr); + + pidCpuLOB = ksmodel_get_pid_back(_histoPtr, + LOWER_OVERFLOW_BIN, + cpuFront, + false, + _collectionPtr, + nullptr); + if (pidCpu0 < 0 && pidCpuLOB == pid) { /* * The Task is the last one running on this * CPU. Set the Pid of the bin. In this case -- 2.17.1
![]() |