From patchwork Wed Mar 13 15:22:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10851365 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 7C7F2139A for ; Wed, 13 Mar 2019 15:22:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 665DF29EBA for ; Wed, 13 Mar 2019 15:22:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6408C29F33; Wed, 13 Mar 2019 15:22: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 0FE3D29F21 for ; Wed, 13 Mar 2019 15:22:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726033AbfCMPWu (ORCPT ); Wed, 13 Mar 2019 11:22:50 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34256 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725868AbfCMPWu (ORCPT ); Wed, 13 Mar 2019 11:22:50 -0400 Received: by mail-wm1-f66.google.com with SMTP id o10so4701828wmc.1 for ; Wed, 13 Mar 2019 08:22: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=aufaCDtkY9mXlP1hwty/h041sVOcnpu0fmxVOqJsGKg=; b=iTDLf/XNLYzrDzss1U/9j/FYapkQrgEenAQiY+yzsZR6oi+JuCJLPjH8mpVJGuz+7o f68ueV8rImek6Fz0MyiFj4GWWtxTlZlvGS8rp15uYgfRdvFaBtpgykXwjQhtYRx2Ivql oxD4mmO3TbnTeouJWFCuIOIc1IZiFh4bCKVk/6bj0HlntRVre5fDZRURcmB7EfW+xJXs ToeAZKkZdx09agX48UDm5R/ELr40OqEUKii/0U8yl1X3D0XGoi/n/BLvtwi+TliVJH5E xl9O1iaaJHmo/R08AcGrUsu4cr/wgvQ2FF5sMf3bsEj6GFtBPqGBcI+A6WGbFoAM08yz BHxQ== X-Gm-Message-State: APjAAAWuWluBcQRuBO/ps2t1KzyC8g+azAuP0MK/7xTCGB28v9srqeos J5DYdgYbgaUQNbB9Qh9DjBM= X-Google-Smtp-Source: APXvYqx37fTZOAIDFpelFkSNXfwFIy7j2IPlhQeULrDDyF0e/EKa10N2ABTgVjMFG7rHRNpbSGAdow== X-Received: by 2002:a1c:a186:: with SMTP id k128mr2656386wme.54.1552490568257; Wed, 13 Mar 2019 08:22:48 -0700 (PDT) Received: from localhost.localdomain ([95.87.198.56]) by smtp.gmail.com with ESMTPSA id w10sm20775822wrn.32.2019.03.13.08.22.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 08:22:47 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Yordan Karadzhov Subject: [PATCH v2 1/3] kernel-shark: Reorder the priority when searching for trace-cmd libs Date: Wed, 13 Mar 2019 17:22:18 +0200 Message-Id: <20190313152220.22026-2-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313152220.22026-1-ykaradzhov@vmware.com> References: <20190313152220.22026-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 Wed Mar 13 15:22:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10851367 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 9EABE17EF for ; Wed, 13 Mar 2019 15:22:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89EDF297B6 for ; Wed, 13 Mar 2019 15:22:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8786829F2E; Wed, 13 Mar 2019 15:22: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 09832297B6 for ; Wed, 13 Mar 2019 15:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725868AbfCMPWv (ORCPT ); Wed, 13 Mar 2019 11:22:51 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40498 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726011AbfCMPWv (ORCPT ); Wed, 13 Mar 2019 11:22:51 -0400 Received: by mail-wm1-f67.google.com with SMTP id g20so2278487wmh.5 for ; Wed, 13 Mar 2019 08:22:50 -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=tQevJRRUFASCuExjPBPCtEpKTIB4DClt89m6t1aOYpM=; b=WuryOzPMk9BYqXee9Iy/s1W8ARYGDP9DQFTZidruHrCti3hld7qt8fnQOi2dAaGzza m4OxNuahdm+vkYGIWnJXwGTwqqwJnZXIJjOvhbYJWmNrjTkYfKf05iG3Sa2Gw03HM4Vl YljrrTwg8F7UNJ3hnVEElnyvrwfrfAO7Zf7qaL+AsIHXVlR67fXLiqcQO7eTo/1IXoPL Zkxm/GVuNe/UElQmP0Yk5kKPxOyh8LvneEuoYX4Vm6HUPVyzBWlBkE+5/yYMpQ3P0ESn hPCdjvrLiUmXHC7QAUrux9Tq3hnY2lHpStTlQ0ZzOG7m6kK3TegsuMAcd+dkJ/XeyEbg oLNw== X-Gm-Message-State: APjAAAWktH5+uvdNjRfpTvuk+BqPtGkpneH4w+g3Mfj1vQEapG/Pf4eX yEtgA3wO/G0dS14ZldK9b/E= X-Google-Smtp-Source: APXvYqxELE9myarokPI3/boZzHRQp6TQMCt5vkYqXdnt6BYTntoRQvV3HVh59FXp/PxjRoc9StuZQA== X-Received: by 2002:a1c:cb86:: with SMTP id b128mr2660607wmg.46.1552490569644; Wed, 13 Mar 2019 08:22:49 -0700 (PDT) Received: from localhost.localdomain ([95.87.198.56]) by smtp.gmail.com with ESMTPSA id w10sm20775822wrn.32.2019.03.13.08.22.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 08:22:49 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Yordan Karadzhov Subject: [PATCH v2 2/3] kernel-shark: Configuration information in ${HOME}/.cache/kernelshark Date: Wed, 13 Mar 2019 17:22:19 +0200 Message-Id: <20190313152220.22026-3-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313152220.22026-1-ykaradzhov@vmware.com> References: <20190313152220.22026-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}/.cache/kernelshark After applying this patch you may need to clean the CMAKE cache. This can be done by: cd kernel-shark/build/;./cmake_clean.sh; cd - make gui Suggested-by: Steven Rostedt (VMware) Signed-off-by: Yordan Karadzhov --- Makefile | 2 +- kernel-shark/CMakeLists.txt | 13 ++++++++----- kernel-shark/build/deff.h.cmake | 4 ++-- kernel-shark/src/KsMainWindow.cpp | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index b780718..4cebd00 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_CACHE_DIR=$(HOME)/.cache/kernelshark .. 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..c3743b4 100644 --- a/kernel-shark/CMakeLists.txt +++ b/kernel-shark/CMakeLists.txt @@ -12,10 +12,12 @@ message("\n project: Kernel Shark: (version: ${KS_VERSION_STRING})\n") 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.") -file(MAKE_DIRECTORY ${KS_CONF_DIR}) +# Make a directory to hold cached configuration files. To change this do: +# cmake .. -DKS_CACHE_DIR=/your/preferred/path +set(KS_CACHE_DIR "$ENV{HOME}/.cache/kernelshark" + CACHE STRING "Directory for cached configuration files.") + +file(MAKE_DIRECTORY ${KS_CACHE_DIR}) include(${KS_DIR}/build/FindTraceCmd.cmake) include(${KS_DIR}/build/FindJSONC.cmake) @@ -59,7 +61,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_CACHE_DIR}") add_subdirectory(${KS_DIR}/src) add_subdirectory(${KS_DIR}/examples) diff --git a/kernel-shark/build/deff.h.cmake b/kernel-shark/build/deff.h.cmake index 80d624c..56b37da 100644 --- a/kernel-shark/build/deff.h.cmake +++ b/kernel-shark/build/deff.h.cmake @@ -14,8 +14,8 @@ /** KernelShark source code path. */ #cmakedefine KS_DIR "@KS_DIR@" -/** KernelShark configuration directory path. */ -#cmakedefine KS_CONF_DIR "@KS_CONF_DIR@" +/** KernelShark cache directory path. */ +#cmakedefine KS_CACHE_DIR "@KS_CACHE_DIR@" /** Location of the trace-cmd executable. */ #cmakedefine TRACECMD_BIN_DIR "@TRACECMD_BIN_DIR@" diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp index 8ac19a7..d832f3f 100644 --- a/kernel-shark/src/KsMainWindow.cpp +++ b/kernel-shark/src/KsMainWindow.cpp @@ -133,7 +133,7 @@ KsMainWindow::KsMainWindow(QWidget *parent) KsMainWindow::~KsMainWindow() { kshark_context *kshark_ctx(nullptr); - QString file = KS_CONF_DIR; + QString file = KS_CACHE_DIR; file += "/lastsession.json"; @@ -370,7 +370,7 @@ void KsMainWindow::_open() void KsMainWindow::_restorSession() { - QString file = KS_CONF_DIR; + QString file = KS_CACHE_DIR; file += "/lastsession.json"; loadSession(file); From patchwork Wed Mar 13 15:22:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10851369 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 E087F17E6 for ; Wed, 13 Mar 2019 15:22:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9B6B295F6 for ; Wed, 13 Mar 2019 15:22:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C787F29E97; Wed, 13 Mar 2019 15:22:53 +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 5CD9F29EF6 for ; Wed, 13 Mar 2019 15:22:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726039AbfCMPWx (ORCPT ); Wed, 13 Mar 2019 11:22:53 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:40500 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726011AbfCMPWx (ORCPT ); Wed, 13 Mar 2019 11:22:53 -0400 Received: by mail-wm1-f65.google.com with SMTP id g20so2278568wmh.5 for ; Wed, 13 Mar 2019 08:22: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=R1tQSLUn2UAHXqEDBQ+rkzOLVKjvtqYATX6BM3OmaZ0=; b=RrNwbGR1NzQ7HHQXDBHPVXtCa9X08WksQ86NLt4qbdQ8saVW8Q0ToX/W7CrtbM7Kx9 JGQZbFbTCFIn7N2rwkyvlIKpVgmUXgeXgLw/dgFL4gvJVi4b6u4QxI3Fs1lVkjR87olb Frvp6i94PpcKQOAQQ9uR2pxRSazR3+hb2Vv7rMYP0CENUtO7Bwb0YBxd/EPQpXkPyKxt 6mfW0UtEcndkxgNF3OXGw+RmLNm4ihOkazAUAqpgEbA4OJpK11OfBkhS4crrKFT1RFcb QPZQwWzQzwUQjXkKCAhQ6+RSX4aVGvmfZcrnLTddJDrO+ZQlsctecuDCt1qsXxfn7jG6 4V5w== X-Gm-Message-State: APjAAAXkKKvOe3uBkj3DVw4SPhaf8VGUq6Tv8fK7KKojoj4wN0lAL9ZO NvuV3CDETIIAgBn0GivO0EY= X-Google-Smtp-Source: APXvYqz/ZmSZpm/MNasm530Tj75dmOsJCCM/WJJejQZb+eoRGPF1SWhkjtSFeBdqLMydyt4KYvYrIQ== X-Received: by 2002:a05:600c:2201:: with SMTP id z1mr2716761wml.16.1552490571376; Wed, 13 Mar 2019 08:22:51 -0700 (PDT) Received: from localhost.localdomain ([95.87.198.56]) by smtp.gmail.com with ESMTPSA id w10sm20775822wrn.32.2019.03.13.08.22.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 08:22:50 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Yordan Karadzhov Subject: [PATCH v2 3/3] kernel-shark: Set the configuration cache directory via env. variable Date: Wed, 13 Mar 2019 17:22:20 +0200 Message-Id: <20190313152220.22026-4-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313152220.22026-1-ykaradzhov@vmware.com> References: <20190313152220.22026-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_USER_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 | 20 +++++++++++++------- kernel-shark/src/KsMainWindow.hpp | 2 ++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp index d832f3f..a92944e 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_CACHE_DIR; - - file += "/lastsession.json"; + QString file = lastSessionFile(); _updateSession(); kshark_save_config_file(file.toLocal8Bit().data(), @@ -368,12 +366,20 @@ void KsMainWindow::_open() loadDataFile(fileName); } -void KsMainWindow::_restorSession() +/** Get the description file of the last session. */ +QString KsMainWindow::lastSessionFile() { - QString file = KS_CACHE_DIR; - file += "/lastsession.json"; + const char *file = getenv("KS_USER_CONF_DIR"); - loadSession(file); + if (!file) + file = KS_CACHE_DIR; + + return QString(file) + "/lastsession.json"; +} + +void KsMainWindow::_restorSession() +{ + loadSession(lastSessionFile()); _graph.updateGeom(); } diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp index a93382a..c479520 100644 --- a/kernel-shark/src/KsMainWindow.hpp +++ b/kernel-shark/src/KsMainWindow.hpp @@ -37,6 +37,8 @@ public: void loadSession(const QString &fileName); + QString lastSessionFile(); + /** * @brief *