From patchwork Wed May 15 19:09: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: 10945071 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 8CECC13AD for ; Wed, 15 May 2019 19:10:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 713F92841D for ; Wed, 15 May 2019 19:10:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 651132867C; Wed, 15 May 2019 19:10:04 +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 B719C2841D for ; Wed, 15 May 2019 19:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727115AbfEOTKD (ORCPT ); Wed, 15 May 2019 15:10:03 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:43415 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726619AbfEOTKD (ORCPT ); Wed, 15 May 2019 15:10:03 -0400 Received: by mail-pf1-f193.google.com with SMTP id c6so439094pfa.10 for ; Wed, 15 May 2019 12:10:02 -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=fMopaRiEkLJFdgNMCidCCP9ePIfite2UI6gPtVnZA0c=; b=oyw4VV3CMSm2sYCmRj50aNn6sXdcBpPj+B9V+lgCyUnCLdHRX26Wsmf19hfbETq1ew Ij79b50xXl2nAMDi+9Zoe4EwCMKNFnD5bycRKeE2ULEM6Py4bm5cUSGyj/27OTvg+cw1 hJ9ouwxkBtJfzHwcmPXeEKV7w4sdr7rn7XKevVjpD6qDtFdeKTeRz2QHUCU5X/M//kzo Fjga/izQ5AG9cXZf6VN8Vmu1uI+McXkta1BtsI+YSkRBoeb1ntpHtmjNj7mQIpRkymBw b92m2s1ZHSMP3/flZWffL+NWdDZdKb7Dz9sVW693QoEOH+ip2iubtfYGdXLjAbYTs41R 15Ug== X-Gm-Message-State: APjAAAUoBFgyoEy9mcT/SWNeTc3XkYIbPHK9BW7ZCLhKEIaAllwHnqAB xZ+dhhC7MmSdrmpPF0sC1sY= X-Google-Smtp-Source: APXvYqzvH0JHdzcsA5fzfmI9tGWG/m+KwcJRVakcyTao3LZMWCwkPqnng//fHxchvsmzrLH8QwHqWg== X-Received: by 2002:a63:fd0c:: with SMTP id d12mr46250047pgh.391.1557947402396; Wed, 15 May 2019 12:10:02 -0700 (PDT) Received: from localhost.localdomain (50-204-120-225-static.hfc.comcastbusiness.net. [50.204.120.225]) by smtp.gmail.com with ESMTPSA id l65sm5772595pfb.7.2019.05.15.12.10.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 May 2019 12:10:01 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, Yordan Karadzhov , Troy Engel , Bas van Dijk Subject: [PATCH 1/6] kernel-shark: Remove hard-coded install paths Date: Wed, 15 May 2019 12:09:06 -0700 Message-Id: <20190515190911.20755-2-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190515190911.20755-1-ykaradzhov@vmware.com> References: <20190515190911.20755-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 definitions of KS_APP_NAME and KS_ICON are used to derive standard installation paths for the KernelShark libraries, plugins and icons. The patch combines improvements suggested by Troy Engel and Bas van Dijk. Suggested-by: Troy Engel Suggested-by: Bas van Dijk Signed-off-by: Yordan Karadzhov --- kernel-shark/CMakeLists.txt | 8 ++++++-- kernel-shark/build/deff.h.cmake | 3 +++ kernel-shark/build/ks.desktop.cmake | 4 ++-- kernel-shark/src/CMakeLists.txt | 19 +++++++++++-------- kernel-shark/src/KsUtils.cpp | 4 ++-- kernel-shark/src/plugins/CMakeLists.txt | 3 +-- 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt index 1aee858..b886e2c 100644 --- a/kernel-shark/CMakeLists.txt +++ b/kernel-shark/CMakeLists.txt @@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR) # Set the name and version of the project project(kernel-shark) +set(KS_APP_NAME "kernelshark") set(KS_VERSION_MAJOR 0) set(KS_VERSION_MINOR 9) set(KS_VERSION_PATCH 8) @@ -39,6 +40,9 @@ if(NOT _INSTALL_PREFIX) set(_INSTALL_PREFIX "/usr/local") endif() +set(KS_PLUGIN_INSTALL_PREFIX ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/plugins/) +set(KS_ICON ksharkicon.png) + if (NOT _DEBUG) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") @@ -46,7 +50,7 @@ if (NOT _DEBUG) endif (NOT _DEBUG) -SET(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/kshark/") +SET(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/") SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) include_directories(${KS_DIR}/src/ @@ -79,7 +83,7 @@ if (_DOXYGEN_DOC AND DOXYGEN_FOUND) endif () configure_file( ${KS_DIR}/build/ks.desktop.cmake - ${KS_DIR}/kernelshark.desktop) + ${KS_DIR}/${KS_APP_NAME}.desktop) configure_file( ${KS_DIR}/build/org.freedesktop.kshark-record.policy.cmake ${KS_DIR}/org.freedesktop.kshark-record.policy) diff --git a/kernel-shark/build/deff.h.cmake b/kernel-shark/build/deff.h.cmake index 1cf8a80..efee2a1 100644 --- a/kernel-shark/build/deff.h.cmake +++ b/kernel-shark/build/deff.h.cmake @@ -14,6 +14,9 @@ /** KernelShark installation prefix path. */ #cmakedefine _INSTALL_PREFIX "@_INSTALL_PREFIX@" +/** KernelShark plugins installation prefix path. */ +#cmakedefine KS_PLUGIN_INSTALL_PREFIX "@KS_PLUGIN_INSTALL_PREFIX@" + /** Location of the trace-cmd executable. */ #cmakedefine TRACECMD_BIN_DIR "@TRACECMD_BIN_DIR@" diff --git a/kernel-shark/build/ks.desktop.cmake b/kernel-shark/build/ks.desktop.cmake index 10e3610..2b02c0d 100644 --- a/kernel-shark/build/ks.desktop.cmake +++ b/kernel-shark/build/ks.desktop.cmake @@ -4,7 +4,7 @@ Type=Application Name=Kernel Shark GenericName=Kernel Shark Comment= -Exec=@_INSTALL_PREFIX@/bin/kernelshark -Icon=@KS_DIR@/icons/ksharkicon.png +Exec=@_INSTALL_PREFIX@/bin/@KS_APP_NAME@ +Icon=@_INSTALL_PREFIX@/share/icons/@KS_APP_NAME@/@KS_ICON@ Categories=System; Terminal=false diff --git a/kernel-shark/src/CMakeLists.txt b/kernel-shark/src/CMakeLists.txt index b7dbd7e..6cbc00f 100644 --- a/kernel-shark/src/CMakeLists.txt +++ b/kernel-shark/src/CMakeLists.txt @@ -69,23 +69,26 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND) set_target_properties(kshark-gui PROPERTIES SUFFIX ".so.${KS_VERSION_STRING}") - message(STATUS "kernelshark") - add_executable(kernelshark kernelshark.cpp) - target_link_libraries(kernelshark kshark-gui) + message(STATUS ${KS_APP_NAME}) + add_executable(${KS_APP_NAME} kernelshark.cpp) + target_link_libraries(${KS_APP_NAME} kshark-gui) message(STATUS "kshark-record") add_executable(kshark-record kshark-record.cpp) target_link_libraries(kshark-record kshark-gui) - install(TARGETS kernelshark kshark-record kshark kshark-plot kshark-gui + install(TARGETS ${KS_APP_NAME} kshark-record kshark kshark-plot kshark-gui RUNTIME DESTINATION ${_INSTALL_PREFIX}/bin/ - LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/kshark/) + LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/) - install(FILES "${KS_DIR}/kernelshark.desktop" - DESTINATION /usr/share/applications/) + install(FILES "${KS_DIR}/${KS_APP_NAME}.desktop" + DESTINATION ${_INSTALL_PREFIX}/share/applications/) + + install(FILES "${KS_DIR}/icons/${KS_ICON}" + DESTINATION ${_INSTALL_PREFIX}/share/icons/${KS_APP_NAME}) install(FILES "${KS_DIR}/org.freedesktop.kshark-record.policy" - DESTINATION /usr/share/polkit-1/actions/) + DESTINATION ${_INSTALL_PREFIX}/share/polkit-1/actions/) install(PROGRAMS "${KS_DIR}/bin/kshark-su-record" DESTINATION ${_INSTALL_PREFIX}/bin/) diff --git a/kernel-shark/src/KsUtils.cpp b/kernel-shark/src/KsUtils.cpp index 0020bff..dcedd7b 100644 --- a/kernel-shark/src/KsUtils.cpp +++ b/kernel-shark/src/KsUtils.cpp @@ -619,8 +619,8 @@ char *KsPluginManager::_pluginLibFromName(const QString &plugin, int &n) n = asprintf(&lib, "%s/plugin-%s.so", pathStr.c_str(), pluginStr.c_str()); } else { - n = asprintf(&lib, "%s/lib/kshark/plugins/plugin-%s.so", - _INSTALL_PREFIX, pluginStr.c_str()); + n = asprintf(&lib, "%s/plugin-%s.so", + KS_PLUGIN_INSTALL_PREFIX, pluginStr.c_str()); } return lib; diff --git a/kernel-shark/src/plugins/CMakeLists.txt b/kernel-shark/src/plugins/CMakeLists.txt index 64cf98d..6c77179 100644 --- a/kernel-shark/src/plugins/CMakeLists.txt +++ b/kernel-shark/src/plugins/CMakeLists.txt @@ -18,7 +18,6 @@ function(BUILD_PLUGIN) endfunction() set(PLUGIN_LIST "") - BUILD_PLUGIN(NAME sched_events SOURCE sched_events.c SchedEvents.cpp) list(APPEND PLUGIN_LIST "sched_events default") # This plugin will be loaded by default @@ -29,6 +28,6 @@ BUILD_PLUGIN(NAME missed_events list(APPEND PLUGIN_LIST "missed_events default") # This plugin will be loaded by default install(TARGETS sched_events missed_events - LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/kshark/plugins/) + LIBRARY DESTINATION ${KS_PLUGIN_INSTALL_PREFIX}) set(PLUGINS ${PLUGIN_LIST} PARENT_SCOPE) From patchwork Wed May 15 19:09: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: 10945073 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 8D3DC92A for ; Wed, 15 May 2019 19:10:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EE6028409 for ; Wed, 15 May 2019 19:10:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D0BD2842A; Wed, 15 May 2019 19:10:16 +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 24D3C28409 for ; Wed, 15 May 2019 19:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726619AbfEOTKQ (ORCPT ); Wed, 15 May 2019 15:10:16 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:44348 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726517AbfEOTKP (ORCPT ); Wed, 15 May 2019 15:10:15 -0400 Received: by mail-pg1-f195.google.com with SMTP id z16so235679pgv.11 for ; Wed, 15 May 2019 12:10:15 -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=N7ItfzZKOt1nrRaCHb3cf3KeNap2LA1hzeISdKQJswc=; b=G3V3GHnynqBqQPBgaCSR/7NWdysRSsdPPi8axiSwIo1/BbYrnHWf2w6KZJIBeP+UQX Md7FIkUcSf6qRuIA1qw2fjozpibAbKYEcGbdayY5G0KdvSLvozJy4rIffA1HMk6Ff0t6 d/1MHUeNUjiBmE7o/Th00QXVHhktPflU0dPSk78TZqbJMz9Pj1q67esoQFpawEXYGcSR R6XGRShnch62fyUVp6xNAGiNo3u1XOkItmlq2ceft690SS9GSIdtdRjyJqftYLkriqWE mZWEDJDF2Hj/D2diKU2W6dHIH3aP3hjXdA2+H5nH1pQ8THHRiO/OE1vlGldkXWjm8dnU 7oIQ== X-Gm-Message-State: APjAAAXB7707Vt05h/D1kd5voXc0aXLkXHJDHLpg8jsuUJ7s39YmHhOM DeoC6lutvHtgxOBnJ9kt4cU= X-Google-Smtp-Source: APXvYqw5wA8VgaxEQduzYpFuWQu7KwZB5XIhiOd1OOfV//GWMtCvuKorxXQXwY+dMK8wQXtzBf2ZTA== X-Received: by 2002:a65:62d8:: with SMTP id m24mr45131836pgv.141.1557947415357; Wed, 15 May 2019 12:10:15 -0700 (PDT) Received: from localhost.localdomain (50-204-120-225-static.hfc.comcastbusiness.net. [50.204.120.225]) by smtp.gmail.com with ESMTPSA id l65sm5772595pfb.7.2019.05.15.12.10.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 May 2019 12:10:14 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, Yordan Karadzhov , Troy Engel Subject: [PATCH 2/6] kernel-shark: Use XDG compliant path when saving cached data Date: Wed, 15 May 2019 12:09:07 -0700 Message-Id: <20190515190911.20755-3-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190515190911.20755-1-ykaradzhov@vmware.com> References: <20190515190911.20755-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 Use the QStandardPaths class provided by Qt in order to guarantee that the location of the cached data is XDG compliant. Suggested-by: Troy Engel Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsMainWindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp index 5f326f5..bb593bd 100644 --- a/kernel-shark/src/KsMainWindow.cpp +++ b/kernel-shark/src/KsMainWindow.cpp @@ -409,8 +409,10 @@ QString KsMainWindow::_getCacheDir() if (!QDir(dir).exists()) lamMakePath(true); } else { - dir = QString(QDir::homePath()) + - "/.cache/kernelshark"; + auto appCachePath = QStandardPaths::GenericCacheLocation; + dir = QStandardPaths::writableLocation(appCachePath); + dir += "/kernelshark"; + if (!QDir(dir).exists()) lamMakePath(false); } From patchwork Wed May 15 19:09: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: 10945075 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 1E2AE13AD for ; Wed, 15 May 2019 19:10:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E2582870E for ; Wed, 15 May 2019 19:10:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 027CF287FB; Wed, 15 May 2019 19:10: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 680302877F for ; Wed, 15 May 2019 19:10:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726583AbfEOTK0 (ORCPT ); Wed, 15 May 2019 15:10:26 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34350 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726517AbfEOTK0 (ORCPT ); Wed, 15 May 2019 15:10:26 -0400 Received: by mail-pg1-f194.google.com with SMTP id c13so262450pgt.1 for ; Wed, 15 May 2019 12:10:25 -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=0UepxbYX1clVl10dlAJ3fiSWMgeVvZ368TMAXoM2DDs=; b=SpEW7M5856625xSokud5xbfxvLkD0L8FWk8aT1BD7QrXP5ugfChhwZnAL2kb1u2DW7 Ze1ThN1S2R7OR2Sq0xStra4ekFzMqZMH7o4o4psV7TJcYCPLcx65nblj5RlEbootFVPr Md1z7/UZ8VYY58KblhB3791ZhDUIeFq1k0siIAwC6CK+0NuhKg2VJtK8Fz+2MBxpv7PR Od9ORLuZebrcuZ8b/UqORzS8KP/SCddpJB2+xN/NXy0EklVi4pKTVcYLFEarFFTGzMbS lxHmwP7OAtIn3RTCzdiVaCCYMcqcmDfqe0/EfAr98ViXr/w626PQJnMG5LrE8rP82gsX OMgw== X-Gm-Message-State: APjAAAVyTkG195ZoWrZMzf2CSfdSF9/QfKgzMb8LD5Q4PvSzq1DaF/st C82AO/u5bk7byjTi/Y2IXLo= X-Google-Smtp-Source: APXvYqwrJTc04Y23XH0tyGnjJDzQcofPU+rIzT1MbvJ2wRj4HStoj2dBfLYPgJJXeEumknYWVLpFeg== X-Received: by 2002:a65:48ca:: with SMTP id o10mr45902319pgs.136.1557947425474; Wed, 15 May 2019 12:10:25 -0700 (PDT) Received: from localhost.localdomain (50-204-120-225-static.hfc.comcastbusiness.net. [50.204.120.225]) by smtp.gmail.com with ESMTPSA id l65sm5772595pfb.7.2019.05.15.12.10.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 May 2019 12:10:24 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, Yordan Karadzhov , Slavomir Kaslev Subject: [PATCH 3/6] kernel-shark: Enforce update of the OpenGL widget when loading new session Date: Wed, 15 May 2019 12:09:08 -0700 Message-Id: <20190515190911.20755-4-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190515190911.20755-1-ykaradzhov@vmware.com> References: <20190515190911.20755-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 This is needed in the case when the session was saved at different screen resolution. Reviewed-by: Slavomir Kaslev Reported-by: Steven Rostedt (VMware) Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsGLWidget.hpp | 3 +++ kernel-shark/src/KsMainWindow.cpp | 3 +-- kernel-shark/src/KsTraceGraph.cpp | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel-shark/src/KsGLWidget.hpp b/kernel-shark/src/KsGLWidget.hpp index 3bcecf9..bc5cacf 100644 --- a/kernel-shark/src/KsGLWidget.hpp +++ b/kernel-shark/src/KsGLWidget.hpp @@ -41,6 +41,9 @@ public: void reset(); + /** Reprocess all graphs. */ + void update() {resizeGL(width(), height());} + void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp index bb593bd..3cf10bc 100644 --- a/kernel-shark/src/KsMainWindow.cpp +++ b/kernel-shark/src/KsMainWindow.cpp @@ -435,7 +435,6 @@ QString KsMainWindow::lastSessionFile() void KsMainWindow::_restoreSession() { loadSession(lastSessionFile()); - _graph.updateGeom(); } void KsMainWindow::_importSession() @@ -450,7 +449,6 @@ void KsMainWindow::_importSession() return; loadSession(fileName); - _graph.updateGeom(); } void KsMainWindow::_updateSession() @@ -1100,6 +1098,7 @@ void KsMainWindow::loadSession(const QString &fileName) _session.loadTable(&_view); _colorPhaseSlider.setValue(_session.getColorScheme() * 100); + _graph.updateGeom(); } void KsMainWindow::_initCapture() diff --git a/kernel-shark/src/KsTraceGraph.cpp b/kernel-shark/src/KsTraceGraph.cpp index 6087e96..da2c6aa 100644 --- a/kernel-shark/src/KsTraceGraph.cpp +++ b/kernel-shark/src/KsTraceGraph.cpp @@ -538,6 +538,8 @@ void KsTraceGraph::updateGeom() * allow the scroll bar to disappear when the * widget is extended to maximum. */ + + _glWindow.update(); } void KsTraceGraph::_updateGraphLegends() From patchwork Wed May 15 19:09: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: 10945077 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 106ED13AD for ; Wed, 15 May 2019 19:10:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02B742842B for ; Wed, 15 May 2019 19:10:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E95EE286E0; Wed, 15 May 2019 19:10:29 +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 75D5828762 for ; Wed, 15 May 2019 19:10:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726517AbfEOTK3 (ORCPT ); Wed, 15 May 2019 15:10:29 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40978 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727173AbfEOTK3 (ORCPT ); Wed, 15 May 2019 15:10:29 -0400 Received: by mail-pf1-f195.google.com with SMTP id q17so446615pfq.8 for ; Wed, 15 May 2019 12:10:28 -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=6WfPlN+10nuwKB/nKrdeUrA0kgkdFfN2WWZpTnbQank=; b=rp3vPhFx4+W5OjeqlWQ7w/EpnpT0vDVP8xY/9Fw6QAvpcEVUGGEsMGJLDFbozzxxqb cgUbHUTVJB/1YLMjqmNn+/Jf9OWDek/+YleP6Pbeb1gfLrYBVu5DSpJVC87x8GNAw24G UGF/9VbwL+7ZJUmvNNtOrcO1EQGK2iA+HLSgHrZlaGytAe2YE4EVyAN33tTwu3S6ehFq x2aqXVqSyKp7GkOCxp5sDALgnl7cRxBJlbn0Ib13hTqHDMB8cUxDZAxSFDYxgXoTqpWs VklVvNK/mbN2c/OtFDcjOFimWL6LINEyCuBjF7iYDMQ/3iGhakN4SFWDS9IzqwHWwKdB If2g== X-Gm-Message-State: APjAAAXHYwmK2R+Um9QNMw9f9/cGIRpD5AX0XKME55cdVoC3FOghUJ4E A1j95M6xGAWWlIJRmCBO7K8= X-Google-Smtp-Source: APXvYqyWqrt7eP1ofADfgDMabVTlM/Kmvwuu+sslvNyM54Pkzq9INK9DURFlmJYk82sZ/NOD3M9HTA== X-Received: by 2002:a62:2cc2:: with SMTP id s185mr10288532pfs.106.1557947428658; Wed, 15 May 2019 12:10:28 -0700 (PDT) Received: from localhost.localdomain (50-204-120-225-static.hfc.comcastbusiness.net. [50.204.120.225]) by smtp.gmail.com with ESMTPSA id l65sm5772595pfb.7.2019.05.15.12.10.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 May 2019 12:10:28 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, Yordan Karadzhov , Slavomir Kaslev Subject: [PATCH 4/6] kernel-shark: Add "Report bug" button to "Help" Date: Wed, 15 May 2019 12:09:09 -0700 Message-Id: <20190515190911.20755-5-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190515190911.20755-1-ykaradzhov@vmware.com> References: <20190515190911.20755-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 clicked, the Bugzilla will be opened in the appropriate Web browser for the user's desktop environment. Reviewed-by: Slavomir Kaslev Suggested-by: Steven Rostedt (VMware) Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsMainWindow.cpp | 13 +++++++++++++ kernel-shark/src/KsMainWindow.hpp | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp index 3cf10bc..c7c7f6b 100644 --- a/kernel-shark/src/KsMainWindow.cpp +++ b/kernel-shark/src/KsMainWindow.cpp @@ -67,6 +67,7 @@ KsMainWindow::KsMainWindow(QWidget *parent) _fullScreenModeAction("Full Screen Mode", this), _aboutAction("About", this), _contentsAction("Contents", this), + _bugReportAction("Report a bug", this), _deselectShortcut(this), _settings("kernelshark.org", "Kernel Shark") // organization , application { @@ -288,6 +289,9 @@ void KsMainWindow::_createActions() _contentsAction.setIcon(QIcon::fromTheme("help-contents")); connect(&_contentsAction, &QAction::triggered, this, &KsMainWindow::_contents); + + connect(&_bugReportAction, &QAction::triggered, + this, &KsMainWindow::_bugReport); } void KsMainWindow::_createMenus() @@ -365,6 +369,7 @@ void KsMainWindow::_createMenus() help = menuBar()->addMenu("Help"); help->addAction(&_aboutAction); help->addAction(&_contentsAction); + help->addAction(&_bugReportAction); } void KsMainWindow::_open() @@ -925,6 +930,14 @@ void KsMainWindow::_contents() QUrl::TolerantMode)); } +void KsMainWindow::_bugReport() +{ + QUrl bugs("https://bugzilla.kernel.org/buglist.cgi?component=Trace-cmd%2FKernelshark&product=Tools&resolution=---", + QUrl::TolerantMode); + + QDesktopServices::openUrl(bugs); +} + /** Load trace data for file. */ void KsMainWindow::loadDataFile(const QString& fileName) { diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp index 962de2d..22700d9 100644 --- a/kernel-shark/src/KsMainWindow.hpp +++ b/kernel-shark/src/KsMainWindow.hpp @@ -151,6 +151,8 @@ private: QAction _contentsAction; + QAction _bugReportAction; + QShortcut _deselectShortcut; QString _lastDataFilePath, _lastConfFilePath, _lastPluginFilePath; @@ -205,6 +207,8 @@ private: void _contents(); + void _bugReport(); + void _captureStarted(); void _captureError(QProcess::ProcessError error); From patchwork Wed May 15 19:09: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: 10945079 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 EC03013AD for ; Wed, 15 May 2019 19:10:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD7CB2842B for ; Wed, 15 May 2019 19:10:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D19D828433; Wed, 15 May 2019 19:10:43 +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 691AC2842B for ; Wed, 15 May 2019 19:10:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727173AbfEOTKn (ORCPT ); Wed, 15 May 2019 15:10:43 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:46064 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbfEOTKn (ORCPT ); Wed, 15 May 2019 15:10:43 -0400 Received: by mail-pf1-f196.google.com with SMTP id s11so436796pfm.12 for ; Wed, 15 May 2019 12:10:42 -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=H6lwmKt2n7Pf69RpCrlNpRShPPy7nJ7fY587b1cNBUc=; b=oF2Dfr1dQYdg5kY2JZ/ACxvet6gX0w3hsH0Gj5saaCbRAhuQ1optfiBRbhm3nm6wuM uwc8ITg853KLUzR9YVe8xr12L9h7Sks+9izBB/qAfLj/2pswnNHnC3JKQEfFcU5AI1Ut SNBEsPEsZAqSno0Mu5KgLwis9YkEIaMqpzjZLY58EaKiAdPz7QXoc+cHOnlaw1dp/okH p3qccpZmOcP9sHk0FiM6dEFww5c2RenI58gmmH+egeNtXX0d31l3jZeJXXfNPBfzhEZX 4vY8cM6EmGXI3/FuBHzZmCepCkGK9dwzrjyiQBkKvF5zm2TqqiSARxg12VH7l5aOdJrT jc3Q== X-Gm-Message-State: APjAAAUfjABMYLjZsB5cBuZB/txKfDPiJZisPUrHFMG+aogXzCngJbUv 7sLAu3jkPkD6p+FejcDnRGU= X-Google-Smtp-Source: APXvYqyJPqRplKPeCSSi3BNsz97WV0qsL/H1nPHl0gGz1sV79pJXk+YNURUws2oA3/N3cFILHsBz3w== X-Received: by 2002:a63:2745:: with SMTP id n66mr44882075pgn.208.1557947442508; Wed, 15 May 2019 12:10:42 -0700 (PDT) Received: from localhost.localdomain (50-204-120-225-static.hfc.comcastbusiness.net. [50.204.120.225]) by smtp.gmail.com with ESMTPSA id l65sm5772595pfb.7.2019.05.15.12.10.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 May 2019 12:10:42 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, Yordan Karadzhov Subject: [PATCH 5/6] kernel-shark: Improve the appearance on high screen resolution Date: Wed, 15 May 2019 12:09:10 -0700 Message-Id: <20190515190911.20755-6-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190515190911.20755-1-ykaradzhov@vmware.com> References: <20190515190911.20755-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 Some of the components of the plots haven't been properly scaled when displayed on high screen resolution. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsGLWidget.cpp | 24 ++++++++++++++---------- kernel-shark/src/KsGLWidget.hpp | 2 +- kernel-shark/src/KsPlotTools.cpp | 4 +++- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/kernel-shark/src/KsGLWidget.cpp b/kernel-shark/src/KsGLWidget.cpp index 789514a..ce68052 100644 --- a/kernel-shark/src/KsGLWidget.cpp +++ b/kernel-shark/src/KsGLWidget.cpp @@ -84,24 +84,29 @@ void KsGLWidget::resizeGL(int w, int h) /** Reimplemented function used to plot trace graphs. */ void KsGLWidget::paintGL() { + float size = 1.5 * _dpr; + glClear(GL_COLOR_BUFFER_BIT); /* Draw the time axis. */ if(_data) - _drawAxisX(); + _drawAxisX(size); /* Process and draw all graphs by using the built-in logic. */ _makeGraphs(_cpuList, _taskList); for (auto const &g: _graphs) - g->draw(1.5 * _dpr); + g->draw(size); /* Process and draw all plugin-specific shapes. */ _makePluginShapes(_cpuList, _taskList); while (!_shapes.empty()) { auto s = _shapes.front(); + _shapes.pop_front(); + + s->_size = size; s->draw(); + delete s; - _shapes.pop_front(); } /* @@ -448,22 +453,21 @@ void KsGLWidget::findGraphIds(const kshark_entry &e, *graphTask = -1; } -void KsGLWidget::_drawAxisX() +void KsGLWidget::_drawAxisX(float size) { KsPlot::Point a0(_hMargin, _vMargin / 4), a1(_hMargin, _vMargin / 2); - KsPlot::Point b0(width()/2, _vMargin / 4), b1(width() / 2, _vMargin / 2); + KsPlot::Point b0(width() / 2, _vMargin / 4), b1(width() / 2, _vMargin / 2); KsPlot::Point c0(width() - _hMargin, _vMargin / 4), c1(width() - _hMargin, _vMargin / 2); - int lineSize = 2 * _dpr; a0._size = c0._size = _dpr; a0.draw(); c0.draw(); - KsPlot::drawLine(a0, a1, {}, lineSize); - KsPlot::drawLine(b0, b1, {}, lineSize); - KsPlot::drawLine(c0, c1, {}, lineSize); - KsPlot::drawLine(a0, c0, {}, lineSize); + KsPlot::drawLine(a0, a1, {}, size); + KsPlot::drawLine(b0, b1, {}, size); + KsPlot::drawLine(c0, c1, {}, size); + KsPlot::drawLine(a0, c0, {}, size); } void KsGLWidget::_makeGraphs(QVector cpuList, QVector taskList) diff --git a/kernel-shark/src/KsGLWidget.hpp b/kernel-shark/src/KsGLWidget.hpp index bc5cacf..e141b0a 100644 --- a/kernel-shark/src/KsGLWidget.hpp +++ b/kernel-shark/src/KsGLWidget.hpp @@ -190,7 +190,7 @@ private: int _dpr; - void _drawAxisX(); + void _drawAxisX(float size); void _makeGraphs(QVector cpuMask, QVector taskMask); diff --git a/kernel-shark/src/KsPlotTools.cpp b/kernel-shark/src/KsPlotTools.cpp index 2b16a51..f95ada5 100644 --- a/kernel-shark/src/KsPlotTools.cpp +++ b/kernel-shark/src/KsPlotTools.cpp @@ -1089,8 +1089,10 @@ void Graph::draw(float size) /* Draw as vartical lines all bins containing data. */ for (int i = 0; i < _size; ++i) if (_bins[i]._idFront >= 0 || _bins[i]._idBack >= 0) - if (_bins[i]._visMask & KS_EVENT_VIEW_FILTER_MASK) + if (_bins[i]._visMask & KS_EVENT_VIEW_FILTER_MASK) { + _bins[i]._size = size; _bins[i].draw(); + } auto lamCheckEnsblVal = [this] (int v) { return v > 0 || (v == 0 && !this->_zeroSuppress); From patchwork Wed May 15 19:09: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: 10945081 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 AE10392A for ; Wed, 15 May 2019 19:10:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FEB828433 for ; Wed, 15 May 2019 19:10:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 940DC286E0; Wed, 15 May 2019 19:10:47 +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 0FA7128433 for ; Wed, 15 May 2019 19:10:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727297AbfEOTKq (ORCPT ); Wed, 15 May 2019 15:10:46 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:34349 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbfEOTKq (ORCPT ); Wed, 15 May 2019 15:10:46 -0400 Received: by mail-pl1-f194.google.com with SMTP id w7so338735plz.1 for ; Wed, 15 May 2019 12:10:46 -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=x8NMODX5sqluhbXf6VrgopcpmsYyySuuVWNORWvMLAM=; b=kHTKZCy+iRsQtjtAAKFDqL/Svxaw0Q6rfXgZTt/u9jpdiYsLJbTg63dJRcjmeJYoyL kZbdc6jl/fJTlJmhuNwJFVP0Ftq8NrTvI+1oTHIfgX/lwS7AKTbMre/YKQkM5y5GFHyR POXIe7FkmGjDKxS52AzG7bcTwEAw7q8xn+kJnSofVcj5yiIykiyRpatJBBg4nmQojHew IktD63qrWyHj4Hdx4VIxSNjW0xwE6huW0MzrmCqJg9WOOBwZeyONf8UpvuIgdP5HnkJC 5heS7k1ub3suHClwaVGqOk5PZN1hIPFQJqAFxkh/xGpl+KDV+feLunUDO2gQ0B0HYK9T yqOw== X-Gm-Message-State: APjAAAXBCnBMYLoVNpPXRk4FWGvVSQ+PHc20BK0IV+gxEh68KYTDWgXC RYpQ89NxQ6hBmRbWpHoTqlpFthY5 X-Google-Smtp-Source: APXvYqxFeaHdkH8g5J/trBe0r6te7S2mZXDgLCdIo+q0jbKvo+vxTmvwjwva1OXV/SuVLeiV90ssxQ== X-Received: by 2002:a17:902:6b81:: with SMTP id p1mr45060123plk.207.1557947445871; Wed, 15 May 2019 12:10:45 -0700 (PDT) Received: from localhost.localdomain (50-204-120-225-static.hfc.comcastbusiness.net. [50.204.120.225]) by smtp.gmail.com with ESMTPSA id l65sm5772595pfb.7.2019.05.15.12.10.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 May 2019 12:10:45 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, Yordan Karadzhov Subject: [PATCH 6/6] kernel-shark: Handle the case when the marker points to a filtered entry Date: Wed, 15 May 2019 12:09:11 -0700 Message-Id: <20190515190911.20755-7-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190515190911.20755-1-ykaradzhov@vmware.com> References: <20190515190911.20755-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 Markers can point to entries that are filtered out. In such a case the filtered marker is plotted using a dashed line. Suggested-by: Steven Rostedt (VMware) Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsDualMarker.cpp | 10 +++++++++ kernel-shark/src/KsPlotTools.cpp | 33 +++++++++++++++++++++++++++++- kernel-shark/src/KsPlotTools.hpp | 11 +++++++++- kernel-shark/src/KsTraceViewer.cpp | 22 ++++++++++++-------- 4 files changed, 65 insertions(+), 11 deletions(-) diff --git a/kernel-shark/src/KsDualMarker.cpp b/kernel-shark/src/KsDualMarker.cpp index 5dcbaae..755e246 100644 --- a/kernel-shark/src/KsDualMarker.cpp +++ b/kernel-shark/src/KsDualMarker.cpp @@ -79,9 +79,19 @@ bool KsGraphMark::set(const KsDataStore &data, kshark_trace_histo *histo, size_t pos, int cpuGraph, int taskGraph) { + uint8_t visFlags; + _isSet = true; _pos = pos; _ts = data.rows()[_pos]->ts; + visFlags = data.rows()[_pos]->visible; + + if ((visFlags & KS_TEXT_VIEW_FILTER_MASK) && + (visFlags & KS_GRAPH_VIEW_FILTER_MASK)) + _mark.setDashed(false); + else + _mark.setDashed(true); + _cpu = cpuGraph; _task = taskGraph; diff --git a/kernel-shark/src/KsPlotTools.cpp b/kernel-shark/src/KsPlotTools.cpp index f95ada5..a8eddcd 100644 --- a/kernel-shark/src/KsPlotTools.cpp +++ b/kernel-shark/src/KsPlotTools.cpp @@ -379,6 +379,32 @@ void drawLine(const Point &a, const Point &b, size); } +/** + * @brief Draw a dashed line between point "a" and point "b". + * + * @param a: The first finishing point of the line. + * @param b: The second finishing point of the line. + * @param col: The color of the line. + * @param size: The size of the line. + * @param period: The period of the dashed line. + */ +void drawDashedLine(const Point &a, const Point &b, + const Color &col, float size, float period) +{ + int dx = b.x() - a.x(), dy = b.y() - a.y(); + float mod = sqrt(dx * dx + dy * dy); + int n = mod / period; + Point p1, p2; + + for (int i = 0; i < n; ++i) { + p1.setX(a.x() + (i + .25) * dx / n); + p1.setY(a.y() + (i + .25) * dy / n); + p2.setX(a.x() + (i + .75) * dx / n); + p2.setY(a.y() + (i + .75) * dy / n); + drawLine(p1, p2, col, size); + } +} + /** @brief Create a default line. The two points are initialized at (0, 0). */ Line::Line() : Shape(2) @@ -430,6 +456,7 @@ void Polygon::_draw(const Color &col, float size) const * @brief Create a default Mark. */ Mark::Mark() +: _dashed(false) { _visible = false; _cpu._color = Color(225, 255, 100); @@ -440,7 +467,11 @@ Mark::Mark() void Mark::_draw(const Color &col, float size) const { - drawLine(_a, _b, col, size); + if (_dashed) + drawDashedLine(_a, _b, col, size, 3 * _cpu._size / size); + else + drawLine(_a, _b, col, size); + _cpu.draw(); _task.draw(); } diff --git a/kernel-shark/src/KsPlotTools.hpp b/kernel-shark/src/KsPlotTools.hpp index 11c49eb..ee447f1 100644 --- a/kernel-shark/src/KsPlotTools.hpp +++ b/kernel-shark/src/KsPlotTools.hpp @@ -204,7 +204,10 @@ private: }; void drawLine(const Point &a, const Point &b, - const Color &col, float s); + const Color &col, float size); + +void drawDashedLine(const Point &a, const Point &b, + const Color &col, float size, float period); /** This class represents a straight line. */ class Line : public Shape { @@ -326,6 +329,9 @@ public: void setTaskVisible(bool v); + /** If True, the Mark will be plotted as a dashed line. */ + void setDashed(bool d) {_dashed = d;} + private: void _draw(const Color &col, float size = 1.) const override; @@ -340,6 +346,9 @@ private: /** A point indicating the position of the Mark in a Task graph. */ Point _task; + + /* If True, plot the Mark as a dashed line. */ + bool _dashed; }; /** This class represents a KernelShark graph's bin. */ diff --git a/kernel-shark/src/KsTraceViewer.cpp b/kernel-shark/src/KsTraceViewer.cpp index 04a38b8..05977c3 100644 --- a/kernel-shark/src/KsTraceViewer.cpp +++ b/kernel-shark/src/KsTraceViewer.cpp @@ -493,15 +493,19 @@ void KsTraceViewer::markSwitch() QModelIndex index = _proxyModel.mapFromSource(_model.index(row, 0)); - /* - * The row of the active marker will be colored according to - * the assigned property of the current state of the Dual - * marker. Auto-scrolling is temporarily disabled because we - * do not want to scroll to the position of the marker yet. - */ - _view.setAutoScroll(false); - _view.selectRow(index.row()); - _view.setAutoScroll(true); + if (index.isValid()) { + /* + * The row of the active marker will be colored according to + * the assigned property of the current state of the Dual + * marker. Auto-scrolling is temporarily disabled because we + * do not want to scroll to the position of the marker yet. + */ + _view.setAutoScroll(false); + _view.selectRow(index.row()); + _view.setAutoScroll(true); + } else { + _view.clearSelection(); + } } else { _view.clearSelection(); }