Re: [PATCH 1/4] kernel-shark: Configuration information in ${HOME}/.cache/kernelshark

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 04, 2019 at 05:56:00PM +0300, Yordan Karadzhov wrote:
> 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) <rostedt@xxxxxxxxxxx>
> Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx>
> ---
>  Makefile                          |  5 ++++-
>  kernel-shark/CMakeLists.txt       | 13 ++++++++-----
>  kernel-shark/README               |  8 +++++++-
>  kernel-shark/build/deff.h.cmake   |  4 ++--
>  kernel-shark/src/KsMainWindow.cpp |  4 ++--
>  5 files changed, 23 insertions(+), 11 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index cde45f8..d9b0c0e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -254,7 +254,10 @@ all_cmd: $(CMD_TARGETS)
>  CMAKE_COMMAND = /usr/bin/cmake
>  
>  $(kshark-dir)/build/Makefile: $(kshark-dir)/CMakeLists.txt
> -	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) -D_INSTALL_PREFIX=$(prefix) ..
> +
> +	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) \
> +		-D_KS_CACHE_DIR=$(HOME)/.cache/kernelshark \
                                ^
Which $HOME would that be? The one for the user who built kernelshark and not the user who runs it.


> +		-D_INSTALL_PREFIX=$(prefix) ..
>  
>  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 8858eb7..14d73f5 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 .. -D_KS_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)
> @@ -66,7 +68,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/README b/kernel-shark/README
> index 9f7db26..a75b08b 100644
> --- a/kernel-shark/README
> +++ b/kernel-shark/README
> @@ -52,8 +52,14 @@ as a CMake Command-Line option.
>  2.1.3 By default, installation prefix is "/usr/local". It can be changed using
>  -D_INSTALL_PREFIX= as a CMake Command-Line option.
>  
> -Example:
> +2.1.4 By default, the directory that holds cached configuration files is
> +${HOME}/.cache/kernelshark/ .It can be changed using -D_KS_CACHE_DIR=
> +as a CMake Command-Line option. Use only absolute paths for this option.
> +
> +
> +Examples:
>      cmake -D_DOXYGEN_DOC=1 -D_DEBUG=1 -D_INSTALL_PREFIX=/usr ../
> +    cmake -D_KS_CACHE_DIR=${PWD}../.kscache ../
>  
>  2.2.1 Use "make clean" if you want to delete all already compiled objects.
>  
> diff --git a/kernel-shark/build/deff.h.cmake b/kernel-shark/build/deff.h.cmake
> index 80d624c..f1f6a35 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 7afb721..d07a89d 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::_restoreSession()
>  {
> -	QString file = KS_CONF_DIR;
> +	QString file = _KS_CACHE_DIR;
>  	file += "/lastsession.json";
>  
>  	loadSession(file);
> -- 
> 2.19.1
> 



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux