From patchwork Fri Mar 8 17:15: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: 10845199 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 7545914E1 for ; Fri, 8 Mar 2019 17:15:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 589152851D for ; Fri, 8 Mar 2019 17:15:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CC11287A5; Fri, 8 Mar 2019 17:15:26 +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 BAC402851D for ; Fri, 8 Mar 2019 17:15:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbfCHRPZ (ORCPT ); Fri, 8 Mar 2019 12:15:25 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33174 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbfCHRPZ (ORCPT ); Fri, 8 Mar 2019 12:15:25 -0500 Received: by mail-wr1-f67.google.com with SMTP id i12so22160928wrw.0 for ; Fri, 08 Mar 2019 09:15:24 -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:mime-version:content-transfer-encoding; bh=aufaCDtkY9mXlP1hwty/h041sVOcnpu0fmxVOqJsGKg=; b=uG+kzxfGpjRqpP3Jh0ip5ZNRSVTmY1zYGp799HKB2/p91ZTNkA4u3c4jNB1kGhudlM R89PGdJvS6kxtT/gngNALWX2UvUAhCq1vAw4em2jTS3vpiGs9iFFGCL3cA9le4Lw6QQM VPlH8fysTYmaVRKt0mv+8aslBWftj42csdz6Sow6yFYNu8JOdSGTBL4MzHajUxqarIIZ 1Ob186ppLzlZjwoGPgeKqk5fM3Ol5Xnd2KYNNScXpdrxrsfPykdGaqut7JigdsppGWjp KRX95ENc/RddYaJTZCOmcw75SMWrj36cVB6ljgssJp1qtn6O4sRZZ9MqToK08fQ8Tyok 1QdQ== X-Gm-Message-State: APjAAAWpYjaet8r0PLYdwCgJvhFRLivKEEWLYnRB6i5DHGnOnoFhvbD+ hSSia24lSLhy+0vDTHq5/MM= X-Google-Smtp-Source: APXvYqzBmRSJ1/j5ZgnyXc0dwKDn+CeFm9Ychxq1uQiQ96MfA3giBrKYzmPNtluB2YrMgYhn/f3bgA== X-Received: by 2002:a5d:4d12:: with SMTP id z18mr12074149wrt.115.1552065323560; Fri, 08 Mar 2019 09:15:23 -0800 (PST) Received: from localhost.localdomain ([95.87.198.56]) by smtp.gmail.com with ESMTPSA id 2sm8026978wrg.89.2019.03.08.09.15.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 09:15:23 -0800 (PST) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Yordan Karadzhov Subject: [PATCH 1/3] kernel-shark: Reorder the priority when searching for trace-cmd libs Date: Fri, 8 Mar 2019 19:15:10 +0200 Message-Id: <20190308171512.15372-2-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190308171512.15372-1-ykaradzhov@vmware.com> References: <20190308171512.15372-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 CMAKE build system of KernelShark performs automated search for the trace-cmd libraries, headers and executable before building the GUI. The new order of the list of directories to search in is the following: 1. ${TRACE_CMD}/ ($TRACE_CMD is an environment variable) 2. CMAKE_SOURCE_DIR/../ 3. Platform / system specific locations Suggested-by: Steven Rostedt (VMware) Signed-off-by: Yordan Karadzhov --- kernel-shark/build/FindTraceCmd.cmake | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/kernel-shark/build/FindTraceCmd.cmake b/kernel-shark/build/FindTraceCmd.cmake index fb2092a..b09a11b 100644 --- a/kernel-shark/build/FindTraceCmd.cmake +++ b/kernel-shark/build/FindTraceCmd.cmake @@ -14,17 +14,27 @@ # MESSAGE(" Looking for trace-cmd ...") +# First search in the user provided paths. find_path(TRACECMD_BIN_DIR NAMES trace-cmd PATHS $ENV{TRACE_CMD}/tracecmd/ - ${CMAKE_SOURCE_DIR}/../tracecmd/) + ${CMAKE_SOURCE_DIR}/../tracecmd/ + NO_DEFAULT_PATH) find_path(TRACECMD_INCLUDE_DIR NAMES trace-cmd.h PATHS $ENV{TRACE_CMD}/include/trace-cmd/ - ${CMAKE_SOURCE_DIR}/../include/trace-cmd/) + ${CMAKE_SOURCE_DIR}/../include/trace-cmd/ + NO_DEFAULT_PATH) find_path(TRACECMD_LIBRARY_DIR NAMES libtracecmd.a PATHS $ENV{TRACE_CMD}/lib/trace-cmd/ - ${CMAKE_SOURCE_DIR}/../lib/trace-cmd/) + ${CMAKE_SOURCE_DIR}/../lib/trace-cmd/ + NO_DEFAULT_PATH) + +# If not found, search in the default system paths. Note that if the previous +# search was successful "find_path" will do nothing this time. +find_path(TRACECMD_BIN_DIR NAMES trace-cmd) +find_path(TRACECMD_INCLUDE_DIR NAMES trace-cmd.h) +find_path(TRACECMD_LIBRARY_DIR NAMES libtracecmd.a) IF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY_DIR) From patchwork Fri Mar 8 17:15: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: 10845201 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 5D0D914E1 for ; Fri, 8 Mar 2019 17:15:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4076A2851D for ; Fri, 8 Mar 2019 17:15:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34E88287C9; Fri, 8 Mar 2019 17:15:27 +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 C55DE2851D for ; Fri, 8 Mar 2019 17:15:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726254AbfCHRP0 (ORCPT ); Fri, 8 Mar 2019 12:15:26 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:51919 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726692AbfCHRP0 (ORCPT ); Fri, 8 Mar 2019 12:15:26 -0500 Received: by mail-wm1-f66.google.com with SMTP id n19so13209324wmi.1 for ; Fri, 08 Mar 2019 09:15:25 -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:mime-version:content-transfer-encoding; bh=H+Kf/O1tmvXj0y/puSt+huAvrppxEVmqP6IUqrPfKeY=; b=aBXaRAGvpyda4wHHPztvg0nMRonYcmxvVS+y/BIhnmV+7Y1I5RWQKdlXG/nlBcyBf8 /x7XE+2tV+y9DAAno8mrIq8g58K4p1j/wIbRkd2y66uy/9CLI2/J4BPRpkL1TMRGkEv7 o14edVyY9ezW3Mcyrpo3B6t5ryR9KpkioRXl9IizMhBCNFJe5dSHeHss6iRd1Yqo4D4N 1KeD/RtgPjdOyTa8bARTkx3RLMk2SKwwSfZg54N79tTleEsv0CeyCwbDCqoIlxVe8vzM lVdade25io5K9rGneQ9KM9hd9bFFge9Q8wuPLcwjzMlKTWnRm3LGaU/Cmrdr2hkHYlct uK/g== X-Gm-Message-State: APjAAAXCxX+gaMlyOkpRYFSrXmIHB7BFwyV5XxXJBOjuMIUobGzsWCEE 0WDT4apJAVLVz6vIDZKiFyZYHYNjcFA= X-Google-Smtp-Source: APXvYqxo4fyzJbhYimyyPg49g78JexrdGDL6v55jmOu2FIyoUxq57WE1dlp6uOYSoViCGvR73vEb3g== X-Received: by 2002:a1c:4889:: with SMTP id v131mr9750527wma.146.1552065324761; Fri, 08 Mar 2019 09:15:24 -0800 (PST) Received: from localhost.localdomain ([95.87.198.56]) by smtp.gmail.com with ESMTPSA id 2sm8026978wrg.89.2019.03.08.09.15.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 09:15:24 -0800 (PST) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Yordan Karadzhov Subject: [PATCH 2/3] kernel-shark: Save the configuration information in ${HOME}/.kshark Date: Fri, 8 Mar 2019 19:15:11 +0200 Message-Id: <20190308171512.15372-3-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190308171512.15372-1-ykaradzhov@vmware.com> References: <20190308171512.15372-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 By default the "Last session" configuration file will be saved in ${HOME}/.kshark Suggested-by: Steven Rostedt (VMware) Signed-off-by: Yordan Karadzhov --- Makefile | 2 +- kernel-shark/CMakeLists.txt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b780718..967c364 100644 --- a/Makefile +++ b/Makefile @@ -254,7 +254,7 @@ all_cmd: $(CMD_TARGETS) CMAKE_COMMAND = /usr/bin/cmake $(kshark-dir)/build/Makefile: $(kshark-dir)/CMakeLists.txt - $(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) .. + $(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) -DKS_CONF_DIR=$(HOME)/.kshark .. gui: force $(CMD_TARGETS) $(kshark-dir)/build/Makefile $(Q)$(MAKE) $(S) -C $(kshark-dir)/build diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt index 20ced14..3c3beb0 100644 --- a/kernel-shark/CMakeLists.txt +++ b/kernel-shark/CMakeLists.txt @@ -14,7 +14,7 @@ set(KS_DIR ${CMAKE_SOURCE_DIR}) # Make a directory to hold configuration files. To change this do: # cmake .. -DKS_CONF_DIR=/your/preferred/path -set(KS_CONF_DIR "${KS_DIR}/.ksconf" CACHE STRING "Directory for configuration files.") +set(KS_CONF_DIR "$ENV{HOME}/.kshark" CACHE STRING "Directory for configuration files.") file(MAKE_DIRECTORY ${KS_CONF_DIR}) include(${KS_DIR}/build/FindTraceCmd.cmake) @@ -59,7 +59,8 @@ include_directories(${KS_DIR}/src/ message("") message(STATUS "C flags : " ${CMAKE_C_FLAGS}) message(STATUS "CXX flags : " ${CMAKE_CXX_FLAGS}) -message(STATUS "Linker flags : " ${CMAKE_EXE_LINKER_FLAGS}) +message(STATUS "Linker flags : " ${CMAKE_EXE_LINKER_FLAGS}\n) +message(STATUS "config. files saved in ${KS_CONF_DIR}") add_subdirectory(${KS_DIR}/src) add_subdirectory(${KS_DIR}/examples) From patchwork Fri Mar 8 17:15: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: 10845203 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 A7A421669 for ; Fri, 8 Mar 2019 17:15:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89F452851D for ; Fri, 8 Mar 2019 17:15:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E791287C9; Fri, 8 Mar 2019 17:15:28 +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 279AF2851D for ; Fri, 8 Mar 2019 17:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726924AbfCHRP2 (ORCPT ); Fri, 8 Mar 2019 12:15:28 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:53608 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726692AbfCHRP1 (ORCPT ); Fri, 8 Mar 2019 12:15:27 -0500 Received: by mail-wm1-f67.google.com with SMTP id e74so13220287wmg.3 for ; Fri, 08 Mar 2019 09:15:26 -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:mime-version:content-transfer-encoding; bh=USNblWiNBIAZkGM3yvr9bbhHNl1m16LZoeASGWKLvN0=; b=WoZF1L2Sr1ZTq7FeFiRCKLmwKVzTO81YIFeMmpoHyTZ1aVODoRiUv/YtjB2hDNjCKf ocraQvF6gZXb1f4C1sSzNTemXkTlPtV/3rOckOiE6gANTaWEqze8HW2AfItowDKatpNP xaln6YmQQagT972b1UcadTCB4KBAT11SpdV3MsHWkBLukSJ9CQ+KOTdv0o4CB/YGEhTw AnUa9A3Twxt0HEVim7GpXrSvsIoiygrx3LgHLyUGcFu6vo/C2yDQ+8e9l3iRXsrTYQL5 A9RNtWZ5MDGWYD97/cAuriTINPtGHkoDoYtfDuQmc/oQJw3bOo68APSvtDtrmBgWQfk/ vXwQ== X-Gm-Message-State: APjAAAWboyhXGzvGxXx+3I8XanHnkWSHEhqaYgcMt/kBcA8FrAJqNaeY TtUSopUD4vhyt7HAW49qan0mTy3UsIs= X-Google-Smtp-Source: APXvYqwInCgKKMorGRI49xOJg+IlnnEK/rqzAiaqUQD6pZ+wD2uf48RZNIw4dvN7DDpXjxTtd9wbvw== X-Received: by 2002:a1c:6042:: with SMTP id u63mr9824915wmb.92.1552065325990; Fri, 08 Mar 2019 09:15:25 -0800 (PST) Received: from localhost.localdomain ([95.87.198.56]) by smtp.gmail.com with ESMTPSA id 2sm8026978wrg.89.2019.03.08.09.15.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 09:15:25 -0800 (PST) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Yordan Karadzhov Subject: [PATCH 3/3] kernel-shark: Set the location of .kshark directory via env. variable Date: Fri, 8 Mar 2019 19:15:12 +0200 Message-Id: <20190308171512.15372-4-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190308171512.15372-1-ykaradzhov@vmware.com> References: <20190308171512.15372-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 environment variable ${KS_CONF_DIR} can be used to specify the directory where the "Last session" configuration file will be saved. Suggested-by: Steven Rostedt (VMware) Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsMainWindow.cpp | 19 ++++++++++++------- kernel-shark/src/KsMainWindow.hpp | 2 ++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp index 2d61c3f..7f39c14 100644 --- a/kernel-shark/src/KsMainWindow.cpp +++ b/kernel-shark/src/KsMainWindow.cpp @@ -133,9 +133,7 @@ KsMainWindow::KsMainWindow(QWidget *parent) KsMainWindow::~KsMainWindow() { kshark_context *kshark_ctx(nullptr); - QString file = KS_CONF_DIR; - - file += "/lastsession.json"; + QString file = _getLastSessionFile(); _updateSession(); kshark_save_config_file(file.toLocal8Bit().data(), @@ -368,12 +366,19 @@ void KsMainWindow::_open() loadDataFile(fileName); } -void KsMainWindow::_restorSession() +QString KsMainWindow::_getLastSessionFile() { - QString file = KS_CONF_DIR; - file += "/lastsession.json"; + const char *file = getenv("KS_CONF_DIR"); - loadSession(file); + if (!file) + file = KS_CONF_DIR; + + return QString(file) + "/lastsession.json"; +} + +void KsMainWindow::_restorSession() +{ + loadSession(_getLastSessionFile()); _graph.updateGeom(); } diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp index 0727631..9b7ec6d 100644 --- a/kernel-shark/src/KsMainWindow.hpp +++ b/kernel-shark/src/KsMainWindow.hpp @@ -153,6 +153,8 @@ private: void _open(); + QString _getLastSessionFile(); + void _restorSession(); void _importSession();