From patchwork Wed Feb 13 16:12:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10810291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 89E9B13B5 for ; Wed, 13 Feb 2019 16:12:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 781F32DED1 for ; Wed, 13 Feb 2019 16:12:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 766FB2DEEA; Wed, 13 Feb 2019 16:12:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22D392DED1 for ; Wed, 13 Feb 2019 16:12:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404329AbfBMQM6 (ORCPT ); Wed, 13 Feb 2019 11:12:58 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:35063 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733017AbfBMQM5 (ORCPT ); Wed, 13 Feb 2019 11:12:57 -0500 Received: by mail-wm1-f66.google.com with SMTP id t200so3044555wmt.0 for ; Wed, 13 Feb 2019 08:12:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WcE7P/MHFpIoLQiFeu/x9vQG07Pw8oDGNgsupsIbd0I=; b=jfB/YipwpKlwC+sPYxwY1pneV5dWrsakTQfMEy3bEDwZlTihUbd/QhzHS2VdSIhRN+ 7lfG6mhHV++wjbFwHuARNauaBThcJO5tUpsyJ1qXPyCsuTmyJDBmYyddUtjGnADwzstQ JhaVahsxbCYTLhXrBS7G+Zu69xUgwdV9XUlrY3xLktnkLcweFD2JefWA5sQ0o+DlTGFV oPUkTWCqTyFKQxJAnahMP4Bl+q1x5W9BhrhDNIRoaS5veBMrWIUw6y32ff8JL/n7T9Zk tYBQXLitzfQPs/HZtH6khC9Fzfh5RqwaIbhpIs6Eh07+gjSz/Slc96duNGq7NANkF0b3 0ywQ== X-Gm-Message-State: AHQUAuaDlLJ8g2SQLIEaUKMOAarwqq4sOOf6tGg1rGnks7mFFQDVXUzI mfknuL0UIeAbs7FEUg15YCk= X-Google-Smtp-Source: AHgI3Iaa9bjL+3NPRJAZrxJItWBKXDlUAz1szKiP7JXup9E6WJDhGEJiODHwmzdQ+JkhwtFV4OEzRA== X-Received: by 2002:a1c:a58c:: with SMTP id o134mr866669wme.79.1550074375681; Wed, 13 Feb 2019 08:12:55 -0800 (PST) Received: from localhost.localdomain ([95.87.211.218]) by smtp.gmail.com with ESMTPSA id h9sm3111631wrv.11.2019.02.13.08.12.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 08:12:55 -0800 (PST) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Yordan Karadzhov Subject: [PATCH 3/8] kernel-shark: Check bin 0 for sched_switch event when plotting task graphs Date: Wed, 13 Feb 2019 18:12:11 +0200 Message-Id: <20190213161216.14438-4-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190213161216.14438-1-ykaradzhov@vmware.com> References: <20190213161216.14438-1-ykaradzhov@vmware.com> Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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