linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH] kernel-shark: Get the path to trace-cmd executable from _INSTALL_PREFIX
Date: Tue, 23 Jul 2019 14:48:37 -0400	[thread overview]
Message-ID: <20190723144837.7616d6d5@gandalf.local.home> (raw)
In-Reply-To: <20190723182542.1295-1-y.karadz@gmail.com>

On Tue, 23 Jul 2019 21:25:42 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> The absolute path to the trace-cmd executable gets derived from
> "_INSTALL_PREFIX", and the "Record" dialog will be using its installed
> version. This is done because nothing guaranties that the trace-cmd
> executable will be presented at the time when the KernelShark package
> is built. The rule has one exception and this is the case when the build
> type is "Debug". In "Debug" mode the "Record" dialog will try to use the
> version of the trace-cmd executable from the build location.
> 
> Sugested-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>

Thanks Yordan!

I just applied this and tested it this way.

On my build system, I removed all trace-cmd and kernelshark code, and
did this:

 $ mkdir /tmp/packages
 $ make clean
 $ make DESTDIR=/tmp/packages prefix=/usr install_gui
 $ cd /tmp/packages
 $ tar -cvjf /tmp/ks-package.tar.bz2 .
 $ scp /tmp/ks-package.tar.bz2 test-machine:/tmp

on test-machine:

 $ su -
 # cd /
 # tar xvf /tmp/ks-package.tar.bz2
 # cd ~
 # which kernelshark
/usr/bin/kernelshark
 # kernelshark

And tried a record, and all seems to be working!

-- Steve


> ---
>  kernel-shark/CMakeLists.txt           |  8 ++++----
>  kernel-shark/README                   |  7 ++++++-
>  kernel-shark/build/FindTraceCmd.cmake | 10 ++++++++--
>  3 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt
> index 45c6f23..075c4af 100644
> --- a/kernel-shark/CMakeLists.txt
> +++ b/kernel-shark/CMakeLists.txt
> @@ -13,6 +13,10 @@ message("\n project: Kernel Shark: (version: ${KS_VERSION_STRING})\n")
>  
>  set(KS_DIR ${CMAKE_SOURCE_DIR})
>  
> +if (NOT _INSTALL_PREFIX)
> +    set(_INSTALL_PREFIX "/usr/local")
> +endif (NOT _INSTALL_PREFIX)
> +
>  include(${KS_DIR}/build/FindTraceCmd.cmake)
>  include(${KS_DIR}/build/FindJSONC.cmake)
>  
> @@ -50,10 +54,6 @@ if (NOT CMAKE_CXX_FLAGS_PACKAGE)
>      set(CMAKE_CXX_FLAGS_PACKAGE "-O3")
>  endif (NOT CMAKE_CXX_FLAGS_PACKAGE)
>  
> -if (NOT _INSTALL_PREFIX)
> -    set(_INSTALL_PREFIX "/usr/local")
> -endif (NOT _INSTALL_PREFIX)
> -
>  set(KS_PLUGIN_INSTALL_PREFIX ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/plugins/)
>  
>  set(KS_ICON        KS_icon_shark.svg)
> diff --git a/kernel-shark/README b/kernel-shark/README
> index 7e50479..6c360bb 100644
> --- a/kernel-shark/README
> +++ b/kernel-shark/README
> @@ -86,9 +86,14 @@ By default this build type adds the "-O2" compiler flag. Package maintainers
>  can chose their own compiler flags by providing the corresponding
>  CMAKE_XXXX_FLAGS_PACKAGE Command-Line options (see the example below).
>  
> -Note that when built as a "Package" the RPATH-s of the executables are
> +-- Note that when built as a "Package" the RPATH-s of the executables are
>  set directly to _INSTALL_PREFIX/lib/kernelshark/
>  
> +-- Note that when built as a "Debug" the "Record" dialog will try to use the
> +version of the trace-cmd executable from the build location. In all other cases
> +the dialog will derive the absolut path to the trace-cmd executable from
> +"_INSTALL_PREFIX", hence the dialog will use the installed version.
> +
>  If no build types is specified, the type will be "RelWithDebInfo".
>  
>  Examples:
> diff --git a/kernel-shark/build/FindTraceCmd.cmake b/kernel-shark/build/FindTraceCmd.cmake
> index 2da4eee..d3e145c 100644
> --- a/kernel-shark/build/FindTraceCmd.cmake
> +++ b/kernel-shark/build/FindTraceCmd.cmake
> @@ -21,6 +21,12 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
>  
>  endif (CMAKE_BUILD_TYPE MATCHES Debug)
>  
> +if (NOT TRACECMD_EXECUTABLE)
> +
> +  set(TRACECMD_EXECUTABLE "${_INSTALL_PREFIX}/bin/trace-cmd")
> +
> +endif (NOT TRACECMD_EXECUTABLE)
> +
>  find_path(TRACECMD_INCLUDE_DIR  NAMES  trace-cmd/trace-cmd.h
>                                  PATHS  $ENV{TRACE_CMD}/include/
>                                         ${CMAKE_SOURCE_DIR}/../include/
> @@ -43,11 +49,11 @@ find_path(TRACECMD_INCLUDE_DIR  NAMES  trace-cmd/trace-cmd.h)
>  find_library(TRACECMD_LIBRARY   NAMES  trace-cmd/libtracecmd.so)
>  find_library(TRACEEVENT_LIBRARY NAMES  traceevent/libtraceevent.so)
>  
> -IF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY AND TRACECMD_EXECUTABLE)
> +IF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY)
>  
>    SET(TRACECMD_FOUND TRUE)
>  
> -ENDIF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY AND TRACECMD_EXECUTABLE)
> +ENDIF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY)
>  
>  IF (TRACECMD_FOUND)
>  


      reply	other threads:[~2019-07-23 18:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23 18:25 [PATCH] kernel-shark: Get the path to trace-cmd executable from _INSTALL_PREFIX Yordan Karadzhov (VMware)
2019-07-23 18:48 ` Steven Rostedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190723144837.7616d6d5@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=y.karadz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).