From patchwork Thu Mar 14 15:10:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10853067 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 7300D1669 for ; Thu, 14 Mar 2019 15:10:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A9162A0BD for ; Thu, 14 Mar 2019 15:10:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58FB82A349; Thu, 14 Mar 2019 15:10:33 +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 E594F2A307 for ; Thu, 14 Mar 2019 15:10:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726845AbfCNPKc (ORCPT ); Thu, 14 Mar 2019 11:10:32 -0400 Received: from mail-pf1-f179.google.com ([209.85.210.179]:40889 "EHLO mail-pf1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfCNPKc (ORCPT ); Thu, 14 Mar 2019 11:10:32 -0400 Received: by mail-pf1-f179.google.com with SMTP id y124so4028822pfy.7 for ; Thu, 14 Mar 2019 08:10:32 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=PTU4K3LnWSxBmMJcYhJd6sNXwqo+Q5Fb+W5U3aL2RJQ=; b=f5V7IgpCVh8xnWwKXUUyB7sT7/mH88S7KaZzw0b5NQoInXhYD7wIgUgWyD/BSIM51H ZKDAOOqqD7nmLN6/71707GTCWFxKf0YJ4snUWuhNncZ7Izy4RZ35+3t4w9DLC7xmYX6N dP/xAoav9c/kOwoUKJPT5JsMmx3ahT0p7DXDg9u0ko6gO7cHL1cBIzaPZnZUgVoFDi4z 3wwzGMvz7Hdf4m7v2IJOV2QFzuAEUjH98dIYea882iwb0X30mcEh8e+Iwafz1KXae1m0 0t+VX0H95sdWITk5v96PFOQa3/pcBnF5ijHB+3MynBlat4PUg1jGjv/lWAo1fpZ+Xtvx kI3Q== X-Gm-Message-State: APjAAAVhVMCgIheXEbq3cgdKHbIzSMYnFpaQggUvY/OYUtTcXUsfW5IO MFFat6JOsiFPc3AWNI6BOaWqWiS6 X-Google-Smtp-Source: APXvYqwsYhp8LacW3GVfd4ku5BfrXPoWWFl67VeL6/jQgv1Pwyi6DjYmn03bKLW8DRhzjuODQ+jlHg== X-Received: by 2002:a62:ed06:: with SMTP id u6mr48700472pfh.132.1552576231924; Thu, 14 Mar 2019 08:10:31 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:31 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 01/12] kernel-shark: Fix a spelling typo in KsMainWindow class Date: Thu, 14 Mar 2019 17:10:01 +0200 Message-Id: <20190314151012.905-2-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 _restorSession* -> _restoreSession* ^ Suggested-by: Slavomir Kaslev Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsMainWindow.cpp | 12 ++++++------ kernel-shark/src/KsMainWindow.hpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp index a92944e..91e0c9f 100644 --- a/kernel-shark/src/KsMainWindow.cpp +++ b/kernel-shark/src/KsMainWindow.cpp @@ -43,7 +43,7 @@ KsMainWindow::KsMainWindow(QWidget *parent) _capture(this), _captureLocalServer(this), _openAction("Open", this), - _restorSessionAction("Restore Last Session", this), + _restoreSessionAction("Restore Last Session", this), _importSessionAction("Import Session", this), _exportSessionAction("Export Sassion", this), _quitAction("Quit", this), @@ -167,9 +167,9 @@ void KsMainWindow::_createActions() connect(&_openAction, &QAction::triggered, this, &KsMainWindow::_open); - _restorSessionAction.setIcon(QIcon::fromTheme("document-open-recent")); - connect(&_restorSessionAction, &QAction::triggered, - this, &KsMainWindow::_restorSession); + _restoreSessionAction.setIcon(QIcon::fromTheme("document-open-recent")); + connect(&_restoreSessionAction, &QAction::triggered, + this, &KsMainWindow::_restoreSession); _importSessionAction.setIcon(QIcon::fromTheme("document-send")); _importSessionAction.setStatusTip("Load a session"); @@ -291,7 +291,7 @@ void KsMainWindow::_createMenus() sessions = file->addMenu("Sessions"); sessions->setIcon(QIcon::fromTheme("document-properties")); - sessions->addAction(&_restorSessionAction); + sessions->addAction(&_restoreSessionAction); sessions->addAction(&_importSessionAction); sessions->addAction(&_exportSessionAction); file->addAction(&_quitAction); @@ -377,7 +377,7 @@ QString KsMainWindow::lastSessionFile() return QString(file) + "/lastsession.json"; } -void KsMainWindow::_restorSession() +void KsMainWindow::_restoreSession() { loadSession(lastSessionFile()); _graph.updateGeom(); diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp index c479520..1ecf2d8 100644 --- a/kernel-shark/src/KsMainWindow.hpp +++ b/kernel-shark/src/KsMainWindow.hpp @@ -99,7 +99,7 @@ private: // File menu. QAction _openAction; - QAction _restorSessionAction; + QAction _restoreSessionAction; QAction _importSessionAction; @@ -155,7 +155,7 @@ private: void _open(); - void _restorSession(); + void _restoreSession(); void _importSession(); From patchwork Thu Mar 14 15:10:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10853069 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 3395C1669 for ; Thu, 14 Mar 2019 15:10:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FE0F2A1C6 for ; Thu, 14 Mar 2019 15:10:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E30D2A2ED; Thu, 14 Mar 2019 15:10:35 +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 C3AEC2A1C6 for ; Thu, 14 Mar 2019 15:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726539AbfCNPKe (ORCPT ); Thu, 14 Mar 2019 11:10:34 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46918 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfCNPKe (ORCPT ); Thu, 14 Mar 2019 11:10:34 -0400 Received: by mail-pf1-f194.google.com with SMTP id s23so4015021pfe.13 for ; Thu, 14 Mar 2019 08:10:34 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=Ef6nhdk31VjtfcmxyPLsDWeiOqYm80MfCr+s976Ei0I=; b=AF11zp7zLL6YLx9blNKOBvnMjOaSODEWykC+zvYbkhyMTu9bqRbetMMpVEVuB0X9Ev Kghv+jzHSbTWj6LT17xx9X1DQYzAnfqfBqkGz3v3xKgy8GzhfxhFASjUFI4BfrT67bKO AW2MMPRbKP9fQiXOIIiJouGc0RYl237PEYjbXjsrhEAjrXzuhPY4Mxa28hb6vhlHJLN2 dP2qkJX6I7MKEeJA5rk+wIS1DDmthBS00MbeYWug8ZuWl1mdz7deSx6IoQZyVm/I0wmk mqW1u0mNpUrClvLBgPwRjNCpHPnHQVATXsVXj8Tapylss4+gqAk4wUYJolvXo4mXTVEh a5Tg== X-Gm-Message-State: APjAAAUFts+1ikVa//B9awEfmOc/6srvX8L9wRufR75G/pzMhgc/guNp JZDpOSZNT1ljjPac9oTt3yZjBMiC X-Google-Smtp-Source: APXvYqzWgyRdGn+yIStALFIatUB9BzKCodtxI9GNBoBVA4sCY14Xb+/vUTULeJJP8FraNIHcMDuIRQ== X-Received: by 2002:a17:902:547:: with SMTP id 65mr51986466plf.242.1552576233881; Thu, 14 Mar 2019 08:10:33 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:33 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 02/12] kernel-shark: Fix a typo in an error message from libkshark-configio Date: Thu, 14 Mar 2019 17:10:02 +0200 Message-Id: <20190314151012.905-3-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 The error message, printed whene kshark_open_json_file() fails, puts the period on a new line. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/libkshark-configio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel-shark/src/libkshark-configio.c b/kernel-shark/src/libkshark-configio.c index ab88864..2bd5600 100644 --- a/kernel-shark/src/libkshark-configio.c +++ b/kernel-shark/src/libkshark-configio.c @@ -1624,7 +1624,7 @@ static struct json_object *kshark_open_json_file(const char *file_name, fail: /* The document has a wrong type. */ - fprintf(stderr, "Failed to open Json file %s\n.", file_name); + fprintf(stderr, "Failed to open Json file %s.\n", file_name); fprintf(stderr, "The document has a wrong type.\n"); json_object_put(jobj); From patchwork Thu Mar 14 15:10:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10853071 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 DA02B6C2 for ; Thu, 14 Mar 2019 15:10:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEAB32A349 for ; Thu, 14 Mar 2019 15:10:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2FD52A3E0; Thu, 14 Mar 2019 15:10:37 +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 B10F92A393 for ; Thu, 14 Mar 2019 15:10:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727135AbfCNPKg (ORCPT ); Thu, 14 Mar 2019 11:10:36 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:36093 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726888AbfCNPKg (ORCPT ); Thu, 14 Mar 2019 11:10:36 -0400 Received: by mail-pg1-f194.google.com with SMTP id r124so4193483pgr.3 for ; Thu, 14 Mar 2019 08:10:36 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=qEaEjF5+SG8MasfO2pX6RdIriVLh4CMuBQKPK+CjZAw=; b=pIpw72TD4iGyQ7Sq+cqMZ/H/msafLt3XQENzE77wEwiwV71uldfGF/atL7APzWtASa a4ee79pBTxHXPHZWhMqIrKDw0Hr2bw5k6EE/lEFzQQQwkGPhg+uCs8Pe/680MOdrYJHR uckw5STO3heFL8BaUtBHwPumdO9qCCroWM3gZhMKXS9vVxS7Jl1ZToCiGT6SlRpdpn+P R76p6Y+Ma6n3kI0E8+KqZvf4n7FpDYfNB2LBSgQNFrUSvgnit5ji9nQbGKDMDOpVDfiO EYVA/+8qoqQfiPWaKU3EsJlJrn0YOcI1Y7jV9iwP7KYB+U4d0z7s7Gsku7GHFpqfgu0r Nm2A== X-Gm-Message-State: APjAAAXVv6hcBOXwgl6JoQUTimGNzsFX05RYxwyYikXX6PT86d0NQGS7 8JAvgzFFrTYAECR2gT4+Ii8Sb1iZ X-Google-Smtp-Source: APXvYqwJNzFB9Mh6kERUeAgKBjip8U/s1Q9P7Yt2cVpgcjXxE5McSZYrKmSzA3d6Jx0lKF5iUrEnew== X-Received: by 2002:a17:902:87:: with SMTP id a7mr51747348pla.295.1552576235761; Thu, 14 Mar 2019 08:10:35 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:35 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 03/12] kernel-shark: Make KsSession::importFromFile return status flag Date: Thu, 14 Mar 2019 17:10:03 +0200 Message-Id: <20190314151012.905-4-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 The function has a better handling of the case when the session description file cannot be loaded. It returns true on success, otherwise false. We need this return flag in order to provide adequate error message in the case when this operation fails. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsSession.cpp | 14 ++++++++++---- kernel-shark/src/KsSession.hpp | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/kernel-shark/src/KsSession.cpp b/kernel-shark/src/KsSession.cpp index 2242a12..b151818 100644 --- a/kernel-shark/src/KsSession.cpp +++ b/kernel-shark/src/KsSession.cpp @@ -28,13 +28,19 @@ KsSession::~KsSession() } /** Import a user session from a Json file. */ -void KsSession::importFromFile(QString jfileName) +bool KsSession::importFromFile(QString jfileName) { - if (_config) + kshark_config_doc *configTmp = + kshark_open_config_file(jfileName.toStdString().c_str(), + "kshark.config.session"); + + if (configTmp) { kshark_free_config_doc(_config); + _config = configTmp; + return true; + } - _config = kshark_open_config_file(jfileName.toStdString().c_str(), - "kshark.config.session"); + return false; } /** Export the current user session from a Json file. */ diff --git a/kernel-shark/src/KsSession.hpp b/kernel-shark/src/KsSession.hpp index f5ed5a1..b07c810 100644 --- a/kernel-shark/src/KsSession.hpp +++ b/kernel-shark/src/KsSession.hpp @@ -37,7 +37,7 @@ public: /** Get the configuration document object. */ kshark_config_doc *getConfDocPtr() const {return _config;} - void importFromFile(QString jfileName); + bool importFromFile(QString jfileName); void exportToFile(QString jfileName); From patchwork Thu Mar 14 15:10:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10853073 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 F01006C2 for ; Thu, 14 Mar 2019 15:10:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBE8C2A1F6 for ; Thu, 14 Mar 2019 15:10:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA2F22A2ED; Thu, 14 Mar 2019 15:10:38 +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 8E9352A3E2 for ; Thu, 14 Mar 2019 15:10:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726643AbfCNPKi (ORCPT ); Thu, 14 Mar 2019 11:10:38 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35525 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfCNPKi (ORCPT ); Thu, 14 Mar 2019 11:10:38 -0400 Received: by mail-pg1-f195.google.com with SMTP id e17so4192453pgd.2 for ; Thu, 14 Mar 2019 08:10:37 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=YuF/EcS7EFekqU+ZXEezGqh6is9aeU2eL8pUaGLp0HU=; b=NMf20S0Uu2nv65vl6/X24NZ5OoOF9OSYUZ1+brYJWtCYOoVez0/Gpcvj/ogng7Bu42 Rp6qD7qHHVwCxeo/ZOItpaN8/IP6CpdmMBBqQhjUxuwTdSY24MF8+ggi0CFrcrgLF+So 4CCMonVD6cZjtnJK+CQ3uNT7gsEJ/VlpBpxuagOMHki0uUWnBB4T6LDlXLYSxu69TJOK M4X7uLhaNirLxLVn2DyGcI0I0e74lAGIdmYZgfc3iZN4WzzXueyXTSgSmM02P2Gx+Ng0 xxJ0JznXPTiJ+QcRq8TWXGGV5/rSsHMMZcNg/pxwbbr6aat0xYV1CCSlpi7td7DpOvwZ Gikw== X-Gm-Message-State: APjAAAVwtesL/WIlSIKZtRecHbMTgGKckcGpRyUjeFs6fMC0AE+aOO9i 5nE6rwSXFohh72caQo9b6ZA= X-Google-Smtp-Source: APXvYqydc72jn1I9By3XFWNU6ARWxvQeuI7CjyUtPVRAmGT1a8ogsu194gAr53VQJgoZlQSUpuhUBQ== X-Received: by 2002:a63:e03:: with SMTP id d3mr28070497pgl.245.1552576237654; Thu, 14 Mar 2019 08:10:37 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:37 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 04/12] kernel-shark: Error message if the opening of the session file fails Date: Thu, 14 Mar 2019 17:10:04 +0200 Message-Id: <20190314151012.905-5-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 Here we add proper handling of the case when the loading of the session description file fails. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsMainWindow.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp index 91e0c9f..44221f6 100644 --- a/kernel-shark/src/KsMainWindow.cpp +++ b/kernel-shark/src/KsMainWindow.cpp @@ -1010,7 +1010,16 @@ void KsMainWindow::loadSession(const QString &fileName) return; } - _session.importFromFile(fileName); + if (!_session.importFromFile(fileName)) { + QString text("Unable to open session description file "); + + text.append(fileName); + text.append(".\n"); + _error(text, "loadSessErr1", true, true); + + return; + } + _session.loadPlugins(kshark_ctx, &_plugins); QString dataFile(_session.getDataFile(kshark_ctx)); From patchwork Thu Mar 14 15:10:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10853075 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 00F796C2 for ; Thu, 14 Mar 2019 15:10:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E03BD2A34B for ; Thu, 14 Mar 2019 15:10:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE8862A3E6; Thu, 14 Mar 2019 15:10:40 +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 8BFC72A30B for ; Thu, 14 Mar 2019 15:10:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726501AbfCNPKk (ORCPT ); Thu, 14 Mar 2019 11:10:40 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:44184 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfCNPKk (ORCPT ); Thu, 14 Mar 2019 11:10:40 -0400 Received: by mail-pg1-f194.google.com with SMTP id h34so4161569pgh.11 for ; Thu, 14 Mar 2019 08:10:39 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=wJcoGckOFj9oO8wuQMOOcPmhEAHLrH/VEmKbEF+MBVs=; b=b2HhKG6E3kq78oAUqoM3eaVSYgssYZTHX/QnYK0k1fUrLRmIvOTGKeDZpn3qw7SACz BqWeys7LHzOik+eSPS21fW5+mMAfMc/DtpoFz7ACYAik/8hii0mdQ18CKzNAPhC8RSWa d+2pwJrctEuvC3BENs2tgPHJ8Q3iWcp+8bL9BcQl50efB9RIISODgZr+c1gh4UxDE0Rc O8v93M7sI2k83Jy3SnynyQqneeFVraOYiEmHjsW+i93pLKLW3Iod9BTunj7nKRNmMOD7 Rijuvf+F5o7avutvspHR/D/JZbRSiBldSbf1KW3xZoEAXMb6h2nM0Pt+4qljBL8I3ous 96+w== X-Gm-Message-State: APjAAAVD87GEKGOnnUbCPbb6iQnm+hqK7x29nkEqKQk1P6dEWP9GU7pL NXmApfdQWLKc9p72OGeEwDEEKyEu X-Google-Smtp-Source: APXvYqxol9kmjrGdbtL+B/qTjeJvxsB7AhmHRXFdrjbhDXWT0jt7OFECjvmjucWUsUWk5KkLc43ZEg== X-Received: by 2002:a63:e101:: with SMTP id z1mr46046421pgh.190.1552576239506; Thu, 14 Mar 2019 08:10:39 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:38 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 05/12] kernel-shark: Disables automatic quotation for errors in KsMainWindow Date: Thu, 14 Mar 2019 17:10:05 +0200 Message-Id: <20190314151012.905-6-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 When quoting in the output stream is disabled, the text of the message is printed without quotations and without escaping of non-printable characters. example output with quoting enabled: ERROR: "Unable to open trace data file for session mysession.json\n" and with quoting disabled: ERROR: Unable to open session description file mysession.json. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsMainWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp index 44221f6..9bcf9e2 100644 --- a/kernel-shark/src/KsMainWindow.cpp +++ b/kernel-shark/src/KsMainWindow.cpp @@ -980,7 +980,7 @@ void KsMainWindow::_error(const QString &text, const QString &errCode, if (unloadPlugins) _plugins.unloadAll(); - qCritical() << "ERROR: " << text; + qCritical().noquote() << "ERROR: " << text; em->showMessage(text, errCode); em->exec(); } From patchwork Thu Mar 14 15:10:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10853077 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 DB46A6C2 for ; Thu, 14 Mar 2019 15:10:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C84E32A297 for ; Thu, 14 Mar 2019 15:10:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C68FA2A32A; Thu, 14 Mar 2019 15:10:42 +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 6A2112A297 for ; Thu, 14 Mar 2019 15:10:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727122AbfCNPKm (ORCPT ); Thu, 14 Mar 2019 11:10:42 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39834 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfCNPKm (ORCPT ); Thu, 14 Mar 2019 11:10:42 -0400 Received: by mail-pf1-f193.google.com with SMTP id i20so4037331pfo.6 for ; Thu, 14 Mar 2019 08:10:41 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=SaAcxvLXdkIUy3oCd1hVeb66KDSze7oeTnLjclEwM08=; b=bcubbhY8bPtVOQmFGmdMwc+ZlBA2YjnO4laxMyyNlcPPygImWBt/kQvG/Ls7nOjw5v w46zSu28nR0pB8otIAejhMgSy5gZOc+aknlVj+rKyrSGtyE9c+3/VScYvl80ISfUVoaI FYDmAUf7Xe4YOlvIytGGAJ7nnXyAOdWzgY8Al9EvHg3q/eym5v/7WhGushldaOgRAc96 qS5Ouz+j42LGsKM835HWpFTc8+j7LYX2WOEIyDl+wRfc1QvDkvMu3dx9JdAVjgL+1s8I VRFOi2gdHOO/9rF6RfeJXcIKqX0jD9+235b0Gjg/RkJKI3d7EVPwme8TTJVThaRUZIqo 6abQ== X-Gm-Message-State: APjAAAU+uk4HmUy5yHs3wdAlsMAsxp+AOcPJVGsXhmwVQCe3+GWuchFV KoIezu6kwt3eeI21KwK4jyX/SoJ6 X-Google-Smtp-Source: APXvYqxM7tNovmVJYSJcUpHAKdlf0Ta+6JT07LSrGixSGDsO0q1koZbPa7P6wh1TcwrYubuZxijxwQ== X-Received: by 2002:a63:c04b:: with SMTP id z11mr44671368pgi.135.1552576241511; Thu, 14 Mar 2019 08:10:41 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:40 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 06/12] kernel-shark: Load Last Session from command line Date: Thu, 14 Mar 2019 17:10:06 +0200 Message-Id: <20190314151012.905-7-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 ./kernelshark -l will load directly the Last Session Signed-off-by : Yordan Karadzhov --- kernel-shark/src/kernelshark.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel-shark/src/kernelshark.cpp b/kernel-shark/src/kernelshark.cpp index 2ec91de..1ec6678 100644 --- a/kernel-shark/src/kernelshark.cpp +++ b/kernel-shark/src/kernelshark.cpp @@ -28,6 +28,7 @@ void usage(const char *prog) printf(" -p register plugin, use plugin name, absolute or relative path\n"); printf(" -u unregister plugin, use plugin name or absolute path\n"); printf(" -s import a session\n"); + printf(" -l import the last session\n"); } int main(int argc, char **argv) @@ -40,7 +41,7 @@ int main(int argc, char **argv) int c; bool fromSession = false; - while ((c = getopt(argc, argv, "hvi:p:u:s:")) != -1) { + while ((c = getopt(argc, argv, "hvi:p:u:s:l")) != -1) { switch(c) { case 'h': usage(argv[0]); @@ -65,6 +66,12 @@ int main(int argc, char **argv) case 's': ks.loadSession(QString(optarg)); fromSession = true; + break; + + case 'l': + ks.loadSession(ks.lastSessionFile()); + fromSession = true; + break; default: break; From patchwork Thu Mar 14 15:10:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10853079 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 452D317EF for ; Thu, 14 Mar 2019 15:10:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 323962A0A7 for ; Thu, 14 Mar 2019 15:10:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30DDA2A393; Thu, 14 Mar 2019 15:10:46 +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 4CB612A0A7 for ; Thu, 14 Mar 2019 15:10:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727136AbfCNPKo (ORCPT ); Thu, 14 Mar 2019 11:10:44 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43484 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfCNPKo (ORCPT ); Thu, 14 Mar 2019 11:10:44 -0400 Received: by mail-pg1-f196.google.com with SMTP id l11so4166701pgq.10 for ; Thu, 14 Mar 2019 08:10:43 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=MerWo/Szyw4Ske9918mV64pxeqlf7o8QeUj4VVt6/pA=; b=oamIJjxZA3NAp+weceJM+k4VlYOJ1UPeFuMrChx8UOR3UcCENnF8R0foefy7t/ZsQu sCQtiKgBcYspqx3oHD3AAvVLgrFE2QbVOJoHfJj6fmFCymfMaJpTC3SmzT//1e83Oxlj yE/iIZ2EpKR3J0qljB1WFZQRBrxy/ZGUGapqednNxUv/QuBjwDHLm0rGHiWAoMxyoV4a mVDqrNhYE1wkb9ILStE1h++C0GZACZokIQw/5BsdroegSCKh/CELHorokBKFBte8puhh SRV8hyjI6IlXKSEOnt68ZAtYflJ84/hODtY94CuWU3rc2cXcNLIyplsbAUgUE8mMWoKI suEQ== X-Gm-Message-State: APjAAAXHmaRi+Ze8SEz1PAYTUBV1m29fYYs1oLNkXdLR5RG03csZAjSW uY/fpYPQmCTSFK3ffJhu4laXFjYF X-Google-Smtp-Source: APXvYqyI/onD/OnfS+GuucauzCZUw5bM9ExRIEhkQpMspte2hkcS++z2yvBryJPIH7s7eGO0AwSH4Q== X-Received: by 2002:a65:6259:: with SMTP id q25mr45914596pgv.235.1552576243337; Thu, 14 Mar 2019 08:10:43 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:42 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 07/12] kernel-shark: Add destructor for KsGLWidget Date: Thu, 14 Mar 2019 17:10:07 +0200 Message-Id: <20190314151012.905-8-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 Not sure how I missed to define this destructor before. The good thing is that the GUI has only one GL widget, and this widget stays alive for the whole duration of the program. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsGLWidget.cpp | 6 ++++++ kernel-shark/src/KsGLWidget.hpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/kernel-shark/src/KsGLWidget.cpp b/kernel-shark/src/KsGLWidget.cpp index 7a050c2..a2fcb8a 100644 --- a/kernel-shark/src/KsGLWidget.cpp +++ b/kernel-shark/src/KsGLWidget.cpp @@ -40,6 +40,12 @@ KsGLWidget::KsGLWidget(QWidget *parent) connect(&_model, SIGNAL(modelReset()), this, SLOT(update())); } +KsGLWidget::~KsGLWidget() +{ + for (auto &g: _graphs) + delete g; +} + /** Reimplemented function used to set up all required OpenGL resources. */ void KsGLWidget::initializeGL() { diff --git a/kernel-shark/src/KsGLWidget.hpp b/kernel-shark/src/KsGLWidget.hpp index 95f307b..3bcecf9 100644 --- a/kernel-shark/src/KsGLWidget.hpp +++ b/kernel-shark/src/KsGLWidget.hpp @@ -31,6 +31,8 @@ class KsGLWidget : public QOpenGLWidget public: explicit KsGLWidget(QWidget *parent = NULL); + ~KsGLWidget(); + void initializeGL() override; void resizeGL(int w, int h) override; From patchwork Thu Mar 14 15:10:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10853081 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 7DB8F1669 for ; Thu, 14 Mar 2019 15:10:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A57D2A0A7 for ; Thu, 14 Mar 2019 15:10:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6908F2A30B; Thu, 14 Mar 2019 15:10:46 +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 215F52A34B for ; Thu, 14 Mar 2019 15:10:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727139AbfCNPKq (ORCPT ); Thu, 14 Mar 2019 11:10:46 -0400 Received: from mail-pf1-f169.google.com ([209.85.210.169]:37870 "EHLO mail-pf1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfCNPKp (ORCPT ); Thu, 14 Mar 2019 11:10:45 -0400 Received: by mail-pf1-f169.google.com with SMTP id 8so621171pfr.4 for ; Thu, 14 Mar 2019 08:10:45 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=hcirEjwUJgEEtaMfUBUC6GWeKcLAiAjHfhiUllCOh+s=; b=MB2H0q+geQMRgUAeV81vFeP4Gr8MLU1EHrd5o4EMmYPr+bcOROzN9Hv6sAk8ivm1xV jL68oOmgWJxmrH1RbMedfwFWwQKAUIS4+X6532uSccw0EImwbtNbV9AlcV5MG7dwF1YG Tu7IH/SiNO3VGamlvHoWiJuB8us8K6oqBd12Rz/mdf9lbAJKU7iEoJzrmWvxQ+G5EtiC QD2TC38AMpVnz80Ll7ByJ7fUOFswerCuKtB8lxPxRZkQ/W07LkPODXgd/9mJcnH+IVXd 79olyskRgBFGdL5mJ6ML2/48frA75V/wbekGfeFHlxIGT2n5hC04IPNfC9ipLSkojERl HmNg== X-Gm-Message-State: APjAAAXM8YnPXsB/RS70c9tMeSFniJXSfVspYRzOWn9GuVn9EeWY1jOx TF9ZSfn5e7i0TbBxHeRsL6rTg4jh X-Google-Smtp-Source: APXvYqx4DFCE4SBtHJxQEJzAtC7iA9ubrAkiwY+7yqUYCLIWte3CSAsPS09cuMdzwffOISQoUHFS2A== X-Received: by 2002:a63:4e4e:: with SMTP id o14mr4641314pgl.254.1552576245107; Thu, 14 Mar 2019 08:10:45 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:44 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 08/12] kernel-shark: Fix memory leak in KsPlotget::getTaskColorTable() Date: Thu, 14 Mar 2019 17:10:08 +0200 Message-Id: <20190314151012.905-9-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 The std::vector constructor used here makes a copy of the data, so the memory used by the original array has to be freed. This is a major leak because getTaskColorTable() gets called every time when we redraw the plots. BTW calling getTaskColorTable() every time when we redraw makes no sense. This will be fixed in the following patch. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsPlotTools.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel-shark/src/KsPlotTools.cpp b/kernel-shark/src/KsPlotTools.cpp index d07f414..2b16a51 100644 --- a/kernel-shark/src/KsPlotTools.cpp +++ b/kernel-shark/src/KsPlotTools.cpp @@ -122,6 +122,8 @@ ColorTable getTaskColorTable() std::vector temp_pids(pids, pids + nTasks); std::sort(temp_pids.begin(), temp_pids.end()); + free(pids); + if (temp_pids[i] == 0) { /* The "Idle" process (pid = 0) will be plotted in black. */ colors[i++] = {}; From patchwork Thu Mar 14 15:10:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10853083 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 79D226C2 for ; Thu, 14 Mar 2019 15:10:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65F882A199 for ; Thu, 14 Mar 2019 15:10:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A5FC2A30B; Thu, 14 Mar 2019 15:10:48 +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 0A6992A199 for ; Thu, 14 Mar 2019 15:10:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727161AbfCNPKr (ORCPT ); Thu, 14 Mar 2019 11:10:47 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:36554 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfCNPKr (ORCPT ); Thu, 14 Mar 2019 11:10:47 -0400 Received: by mail-pf1-f194.google.com with SMTP id n22so4047190pfa.3 for ; Thu, 14 Mar 2019 08:10:47 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=Txtt7FKO70HUFzakSy+vW/ZcFmSp1DjoFu8d/GD32Ug=; b=gosOTdz1QF9yaZBxlEZ/j3MmLlTtFkafl1wKcrHXyNt+WqaH3JNsd94eJmZf7mDlEP LwjWCvq+wHARxRUBwI+konMK99ofGLfnSb23kU5YZJzlY+NAE1NgfE89dvNJk5qrM44o YgZLOJrb/5RfhdKLJZ05MKJnf+QE2chobYihfDWWiuNBI9zqYrrXJwQd8I3fICslzW73 BGcF/HnY6dyxnt4BBNYxkZIrPO7QSX05XJEfEb8QEzCrhEmY9d0llD3DABgT49JIEZ/o rz8BJK5cbqvJHZ9wkwQywelVzhCvOVUCYszRJcHW9qWvGoumSq9VXy5uxFHLlczVfcq9 vWfw== X-Gm-Message-State: APjAAAVtsI2jwH8llbuPmcnYu/i2P0pRgLbFPHAor9WQHSHlyScE+qfG D8IwXOVFQVN81TXj1qPZAd8nhm0H X-Google-Smtp-Source: APXvYqwQVC4yGqERtGMgPAKUD6hJx5cfoKeqC2cgjlR3kEdIfKlt4bU3UajfbWS+0Wc2mglSjv0EoQ== X-Received: by 2002:a63:5817:: with SMTP id m23mr13099648pgb.166.1552576247178; Thu, 14 Mar 2019 08:10:47 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:46 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 09/12] kernel-shark: Avoid the unnecessary calls of KsGLWidget::loadColors() Date: Thu, 14 Mar 2019 17:10:09 +0200 Message-Id: <20190314151012.905-10-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 The tables of colors used by the OpenGL widget have to be updated only when we load a new trace data file. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsGLWidget.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel-shark/src/KsGLWidget.cpp b/kernel-shark/src/KsGLWidget.cpp index a2fcb8a..789514a 100644 --- a/kernel-shark/src/KsGLWidget.cpp +++ b/kernel-shark/src/KsGLWidget.cpp @@ -86,8 +86,6 @@ void KsGLWidget::paintGL() { glClear(GL_COLOR_BUFFER_BIT); - loadColors(); - /* Draw the time axis. */ if(_data) _drawAxisX(); From patchwork Thu Mar 14 15:10:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10853085 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 566A61669 for ; Thu, 14 Mar 2019 15:10:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4293A2A3E0 for ; Thu, 14 Mar 2019 15:10:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 373622A3E8; Thu, 14 Mar 2019 15:10:50 +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 D79712A3E0 for ; Thu, 14 Mar 2019 15:10:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727162AbfCNPKt (ORCPT ); Thu, 14 Mar 2019 11:10:49 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:45911 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfCNPKt (ORCPT ); Thu, 14 Mar 2019 11:10:49 -0400 Received: by mail-pf1-f196.google.com with SMTP id v21so4019434pfm.12 for ; Thu, 14 Mar 2019 08:10:49 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=y3cbyVMfq+8I0WeCaweE+oE9AfAwLE3JBJg9n2ZIxCo=; b=XWTC2nuFYJLpBrLtGJi05L1Ne/t1LJKLdG5/mup8jehoDhy8arVyeFyC5b3sCFoT1q PTdF6ZRqHu9ahlFD6xK9RFD0xay7LD3Sf1Mk6l9LkHiHTwTrPH7ZgVCFRJ2DXLi8UWLZ hZBY3eLSxTk7geY5Ehf08iAMDZ9wE/11YHMHyzUfF92SiA9bGAFif93Kvlav3FYantKx LF9wUqCRcFzDxesZ1xDh7XciHEeNF2B3llWFprxZ6HvzVyvkR9v94u26qE+FFx0oqkLF 0hLIN0HsO6t2ImG/fT4aRvr1gSWucydbWD4t6hHyXdJsP7/VNRdifdh4lYEgn+wBpcvx RPwg== X-Gm-Message-State: APjAAAUgY0gPPLBiO82rdpUCjtSz7k0aYyBfqAe8matCKnr8IKF9Dg2R d4xXLtxlrafg5uxOpTQt1RE= X-Google-Smtp-Source: APXvYqzaD/i83XSjsgalTHw5Wt+kWzUW2I3DbH65QA+70feDACHmRxxsABLUTi8wmbxihSrbiF4NOw== X-Received: by 2002:a17:902:7b92:: with SMTP id w18mr4065208pll.237.1552576248973; Thu, 14 Mar 2019 08:10:48 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:48 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 10/12] kernel-shark: Avoid 0/0 spliter ratio in KsSession Date: Thu, 14 Mar 2019 17:10:10 +0200 Message-Id: <20190314151012.905-11-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 Sometimes when we save the session QSplitter::sizes() returns 0/0 ratio (no idea why). Later when we load the session the 0/0 ratio results in misbehavior of the splitter position. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsSession.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel-shark/src/KsSession.cpp b/kernel-shark/src/KsSession.cpp index b151818..9d86776 100644 --- a/kernel-shark/src/KsSession.cpp +++ b/kernel-shark/src/KsSession.cpp @@ -256,7 +256,7 @@ void KsSession::loadSplitterSize(QSplitter *splitter) { kshark_config_doc *spl = kshark_config_alloc(KS_CONFIG_JSON); json_object *jspl, *jgraphsize, *jviewsize; - int graphSize, viewSize; + int graphSize(1), viewSize(1); QList sizes; if (!kshark_config_doc_get(_config, "Splitter", spl)) @@ -269,6 +269,10 @@ void KsSession::loadSplitterSize(QSplitter *splitter) graphSize = json_object_get_int(jgraphsize); viewSize = json_object_get_int(jviewsize); + if (graphSize == 0 && viewSize == 0) { + /* 0/0 spliter ratio is undefined. Make it 1/1. */ + viewSize = graphSize = 1; + } } sizes << graphSize << viewSize; From patchwork Thu Mar 14 15:10: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: 10853087 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 2E15B1669 for ; Thu, 14 Mar 2019 15:10:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BC402A2E0 for ; Thu, 14 Mar 2019 15:10:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19E282A32A; Thu, 14 Mar 2019 15:10:52 +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 B994E2A34B for ; Thu, 14 Mar 2019 15:10:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727174AbfCNPKv (ORCPT ); Thu, 14 Mar 2019 11:10:51 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:32788 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfCNPKv (ORCPT ); Thu, 14 Mar 2019 11:10:51 -0400 Received: by mail-pf1-f193.google.com with SMTP id i19so4055428pfd.0 for ; Thu, 14 Mar 2019 08:10:51 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=gSKQ5bH65mirLqB3barHk8fmR2aksEZmF9F1bcvAJtM=; b=XixBjbIL8e1Nj68mnteFK04St+gPyRxQpBhYbPKZDlErlMAU4n8FixPI2R6qU3ItmS qtlOTk8mvCmvYADFYQEDwSc7/b9kYTsSvjMv6/IHu+uudcF2S6iWr9kEzcegqt2/ZeFE cW7Hn2053al84BImuqLMV1gjXvRPyqE2LoWcJRUZHiyhT+CzsZ6ko3kz65JtECKawSgy g3zq4FPqrlW5hfQ2+ujcP2Qw2lBYh8TGcPEv2fFQNHzaSfQdyPcxhm8eQkvp4HGXFQ0F RK7umSnGYud1KUigoZt0UsBGeUpTNojGR84OEorkpJKb0JPpyhYgQMjrlR9xoHNQ6XWi wGiA== X-Gm-Message-State: APjAAAU88ubAwbaDCcgHY7CNGpuOEP4qJAjNQbZDz7OsAHjPeNvzLoLb jWhsvAIKryFi4uwveqqMrvo= X-Google-Smtp-Source: APXvYqyPg2JuCmh215V2vvLjSK1oay286fX3mj97CpOvVBEGt8pqtBs9DOOjBVNnkn6na5wFJIrOKQ== X-Received: by 2002:a63:7e0e:: with SMTP id z14mr45722680pgc.436.1552576250752; Thu, 14 Mar 2019 08:10:50 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:50 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 11/12] kernel-shark: In model, handle the case when all bins are empty Date: Thu, 14 Mar 2019 17:10:11 +0200 Message-Id: <20190314151012.905-12-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 ksmodel_set_bin_counts() should not crash in the case when all bins of the model, except the Upper Overflow bin, are empty. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/libkshark-model.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel-shark/src/libkshark-model.c b/kernel-shark/src/libkshark-model.c index af3440b..29676c7 100644 --- a/kernel-shark/src/libkshark-model.c +++ b/kernel-shark/src/libkshark-model.c @@ -290,7 +290,7 @@ static void ksmodel_set_next_bin_edge(struct kshark_trace_histo *histo, static void ksmodel_set_bin_counts(struct kshark_trace_histo *histo) { int i = 0, prev_not_empty; - ssize_t count_tmp; + ssize_t count_tmp = 0; histo->tot_count = 0; memset(&histo->bin_count[0], 0, @@ -303,7 +303,7 @@ static void ksmodel_set_bin_counts(struct kshark_trace_histo *histo) prev_not_empty = LOB(histo); } else { /* Loop till the first non-empty bin. */ - while (histo->map[i] < 0) { + while (histo->map[i] < 0 && i < histo->n_bins) { ++i; } @@ -316,7 +316,8 @@ static void ksmodel_set_bin_counts(struct kshark_trace_histo *histo) */ for (; i < histo->n_bins; ++i) { if (histo->map[i] != KS_EMPTY_BIN) { - /* The current bin is not empty, take its data row and + /* + * The current bin is not empty, take its data row and * subtract it from the data row of the previous not * empty bin, which will give us the number of data * rows in the "prev_not_empty" bin. @@ -358,7 +359,7 @@ static void ksmodel_set_bin_counts(struct kshark_trace_histo *histo) * We will do a sanity check. The number of data rows in the last not * empty bin must be greater than zero. */ - assert(count_tmp > 0); + assert(count_tmp >= 0); histo->tot_count += histo->bin_count[prev_not_empty] = count_tmp; } From patchwork Thu Mar 14 15:10:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10853089 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 803116C2 for ; Thu, 14 Mar 2019 15:10:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D5402A1C6 for ; Thu, 14 Mar 2019 15:10:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BE212A349; Thu, 14 Mar 2019 15:10:54 +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 0842D2A1C6 for ; Thu, 14 Mar 2019 15:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727184AbfCNPKx (ORCPT ); Thu, 14 Mar 2019 11:10:53 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43180 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfCNPKx (ORCPT ); Thu, 14 Mar 2019 11:10:53 -0400 Received: by mail-pf1-f194.google.com with SMTP id q17so4024709pfh.10 for ; Thu, 14 Mar 2019 08:10:52 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=f8C7j7UUJo4vBP/4+DiQuGUXXXxVtCoxu7ygfOE2iGM=; b=tQfFmIMmBU0khL5plIagXHkv5BiK6TRGCMOaxhQh+Eaxbnz3QfwHArqrtX0MkZHRcJ xnwFSRiOMWuYwfkP0OLPgS2GKSdasjGYkCm30lsKRHrYFhtScko1p8j+gF9Axu3H2Qn9 9wwdU2wiQnH7KMWTe7hC891hYLsyEPMJejUmdyksFz6CytiB+lq1S9nNzWtPbwm/UwDS me8o+8HAqyP2sIZEUfqH+U1Qoa+hkgbqF98TyioSz1hTFQvg7YxcmopHGXeyQwa743/U XH2QSJLuC7feQtMfMgf5XJz9ylD9+kTg7fA/jfMPO8tXoW5IQeMhxqWRywmvMErm5RQo DYAg== X-Gm-Message-State: APjAAAVmMdwYibn1pvhe2JvjxQdP12Vd52mcLUcjtb/6OoqYV9shLdSk kwS3Cmg4vEa26+wMgoFwaCup9mbh X-Google-Smtp-Source: APXvYqwPn3DTCVAYryKQShJ08WhD8jUAmmJJtgat0Wu1N9ogrFAo1FHlekyVNkh30hqTIy0OjgLKsw== X-Received: by 2002:a63:a109:: with SMTP id b9mr45126224pgf.328.1552576252606; Thu, 14 Mar 2019 08:10:52 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id f65sm8165585pfg.98.2019.03.14.08.10.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 08:10:52 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 12/12] kernel-shark: In collections, handle the case when the data is small Date: Thu, 14 Mar 2019 17:10:12 +0200 Message-Id: <20190314151012.905-13-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190314151012.905-1-ykaradzhov@vmware.com> References: <20190314151012.905-1-ykaradzhov@vmware.com> MIME-Version: 1.0 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 In particular, handle the case when the size of the data is smaller than the required margin. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/libkshark-collection.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/kernel-shark/src/libkshark-collection.c b/kernel-shark/src/libkshark-collection.c index c70da1e..02a014e 100644 --- a/kernel-shark/src/libkshark-collection.c +++ b/kernel-shark/src/libkshark-collection.c @@ -71,7 +71,7 @@ static bool collection_add_entry(struct entry_list **list, static struct kshark_entry_collection * kshark_data_collection_alloc(struct kshark_context *kshark_ctx, struct kshark_entry **data, - size_t first, + ssize_t first, size_t n_rows, matching_condition_func cond, int val, @@ -81,9 +81,19 @@ kshark_data_collection_alloc(struct kshark_context *kshark_ctx, struct kshark_entry *last_vis_entry = NULL; struct entry_list *col_list, *temp; size_t resume_count = 0, break_count = 0; - size_t i, j, end, last_added = 0; + size_t i, j, last_added = 0; + ssize_t end; bool good_data = false; + /* Create the collection. */ + col_ptr = calloc(1, sizeof(*col_ptr)); + if (!col_ptr) + goto fail; + + end = first + n_rows - margin; + if (first >= end) + return col_ptr; + col_list = malloc(sizeof(*col_list)); if (!col_list) goto fail; @@ -106,7 +116,6 @@ kshark_data_collection_alloc(struct kshark_context *kshark_ctx, temp->type = COLLECTION_IGNORE; } - end = first + n_rows - margin; for (i = first + margin; i < end; ++i) { if (!cond(kshark_ctx, data[i], val)) { /* @@ -204,11 +213,6 @@ kshark_data_collection_alloc(struct kshark_context *kshark_ctx, */ assert(break_count == resume_count); - /* Create the collection. */ - col_ptr = malloc(sizeof(*col_ptr)); - if (!col_ptr) - goto fail; - col_ptr->next = NULL; col_ptr->resume_points = calloc(resume_count,