Tuning the KernelShark build system
cover Tuning the KernelShark build system
This patch set combines few minor tweaks of the KernelShark build system default configurations suggested by Steven.
Yordan Karadzhov (3):
kernel-shark: Reorder the priority when searching for trace-cmd libs
kernel-shark: Save the configuration information in ${HOME}/.kshark
kernel-shark: Set the location of .kshark directory via env. variable
Makefile | 2 +- kernel-shark/CMakeLists.txt | 5 +++-- kernel-shark/build/FindTraceCmd.cmake | 16 +++++++++++++--- kernel-shark/src/KsMainWindow.cpp | 19 ++++++++++++------- kernel-shark/src/KsMainWindow.hpp | 2 ++ 5 files changed, 31 insertions(+), 13 deletions(-)
Signature · 1 line
2.19.1
PATCH 1/3 kernel-shark: Reorder the priority when searching for trace-cmd libs
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
--- kernel-shark/build/FindTraceCmd.cmake | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
kernel-shark/build/FindTraceCmd.cmake +13 -3
@@ -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)
Signature · 1 line
2.19.1
PATCH 2/3 kernel-shark: Save the configuration information in ${HOME}/.kshark
In reply to Yordan KaradzhovBy default the "Last session" configuration file will be saved in ${HOME}/.kshark
--- Makefile | 2 +- kernel-shark/CMakeLists.txt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
Makefile +1 -1
@@ -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
kernel-shark/CMakeLists.txt +3 -2
@@ -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)
Signature · 1 line
2.19.1
Re: [PATCH 2/3] kernel-shark: Save the configuration information in ${HOME}/.kshark
Quoted 3 lines · Yordan Karadzhov
By default the "Last session" configuration file will be saved in ${HOME}/.kshark
${HOME}/.config/foobar seems to be the standard path these days for config files[1]. Wdyt about switching it to ${HOME}/.config/khark?
[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
-- Slavi
Quoted 47 lines
Suggested-by Steven Rostedt (VMware) <[email protected]>Signed-off-by Yordan Karadzhov <[email protected]>--- Makefile | 2 +- kernel-shark/CMakeLists.txt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)Makefile +1
-1@@ -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)/buildkernel-shark/CMakeLists.txt +3
-3@@ -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) --2.19.1
Signature · 1 line
Slavomir Kaslev
Re: [PATCH 2/3] kernel-shark: Save the configuration information in ${HOME}/.kshark
Quoted 9 lines · On Mon, 11 Mar 2019 14:20:23 +0200 Slavomir Kaslev <[email protected]>…
Quoted 3 lines · Yordan Karadzhov
By default the "Last session" configuration file will be saved in ${HOME}/.kshark
${HOME}/.config/foobar seems to be the standard path these days for config files[1]. Wdyt about switching it to ${HOME}/.config/khark?
[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Yeah, I was talking with Patrick McLean (who is a package maintainer for Gentoo) at SCaLE and was saying that we should look at .config. And that's the reference he pointed me to as well.
Note, we may need to use both .config and .cache, as I'm thinking that .cache is better for the saving of last session, and .config should be the default for user defined sessions (Export Session).
-- Steve
Quoted 52 lines
-- Slavi
Quoted 47 lines
Suggested-by Steven Rostedt (VMware) <[email protected]>Signed-off-by Yordan Karadzhov <[email protected]>--- Makefile | 2 +- kernel-shark/CMakeLists.txt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)Makefile +1
-1@@ -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)/buildkernel-shark/CMakeLists.txt +3
-3@@ -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) --2.19.1
Re: [PATCH 2/3] kernel-shark: Save the configuration information in ${HOME}/.kshark
Quoted 13 lines · Steven Rostedt
Quoted 9 lines · On Mon, 11 Mar 2019 14:20:23 +0200 Slavomir Kaslev <[email protected]>…
Quoted 3 lines · Yordan Karadzhov
By default the "Last session" configuration file will be saved in ${HOME}/.kshark
${HOME}/.config/foobar seems to be the standard path these days for config files[1]. Wdyt about switching it to ${HOME}/.config/khark?
[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Quoted 8 lines
Yeah, I was talking with Patrick McLean (who is a package maintainer for Gentoo) at SCaLE and was saying that we should look at .config. And that's the reference he pointed me to as well.
Note, we may need to use both .config and .cache, as I'm thinking that .cache is better for the saving of last session, and .config should be the default for user defined sessions (Export Session).
I will rework the patch.
Thanks a lot!
Y.
Quoted 56 lines
-- Steve
Quoted 52 lines
-- Slavi
Quoted 47 lines
Suggested-by Steven Rostedt (VMware) <[email protected]>Signed-off-by Yordan Karadzhov <[email protected]>--- Makefile | 2 +- kernel-shark/CMakeLists.txt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)Makefile +1
-1@@ -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)/buildkernel-shark/CMakeLists.txt +3
-3@@ -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) --2.19.1
PATCH 3/3 kernel-shark: Set the location of .kshark directory via env. variable
In reply to Yordan KaradzhovThe environment variable ${KS_CONF_DIR} can be used to specify the directory where the "Last session" configuration file will be saved.
--- kernel-shark/src/KsMainWindow.cpp | 19 ++++++++++++------- kernel-shark/src/KsMainWindow.hpp | 2 ++ 2 files changed, 14 insertions(+), 7 deletions(-)
kernel-shark/src/KsMainWindow.cpp +12 -7
@@ -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(); }
kernel-shark/src/KsMainWindow.hpp +2 -0
@@ -153,6 +153,8 @@ private: void _open(); + QString _getLastSessionFile(); + void _restorSession(); void _importSession();
Signature · 1 line
2.19.1
Re: [PATCH 3/3] kernel-shark: Set the location of .kshark directory via env. variable
Quoted 35 lines · Yordan Karadzhov
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) <[email protected]>Signed-off-by Yordan Karadzhov <[email protected]>--- kernel-shark/src/KsMainWindow.cpp | 19 ++++++++++++------- kernel-shark/src/KsMainWindow.hpp | 2 ++ 2 files changed, 14 insertions(+), 7 deletions(-)kernel-shark/src/KsMainWindow.cpp +2
-6@@ -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";
kernel-shark/src/KsMainWindow.cpp void KsMainWindow::_open() · line 379
Quoted 10 lines
kernel-shark/src/KsMainWindow.cpp +8
-1+ const char *file = getenv("KS_CONF_DIR"); - loadSession(file); + if (!file) + file = KS_CONF_DIR; + + return QString(file) + "/lastsession.json"; +} + +void KsMainWindow::_restorSession()
Nit: typo _restorSession() -> _restoreSession()
Quoted 21 lines
kernel-shark/src/KsMainWindow.cpp +2
-0+{ + loadSession(_getLastSessionFile()); _graph.updateGeom(); }kernel-shark/src/KsMainWindow.hpp +2
-1@@ -153,6 +153,8 @@ private: void _open(); + QString _getLastSessionFile(); + void _restorSession(); void _importSession(); --2.19.1
Signature · 1 line
Slavomir Kaslev
Re: [PATCH 3/3] kernel-shark: Set the location of .kshark directory via env. variable
Quoted 9 lines · Slavomir Kaslev
kernel-shark/src/KsMainWindow.cpp void KsMainWindow::_open() · line 379
Quoted 3 lines
kernel-shark/src/KsMainWindow.cpp +3
-0+} + +void KsMainWindow::_restorSession()Nit: typo
_restorSession()->_restoreSession()Quoted 4 lines
kernel-shark/src/KsMainWindow.cpp +2
-0+{ + loadSession(_getLastSessionFile()); _graph.updateGeom(); }
Very well spotted, thanks a lot!
I will fix this.
Y.