linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] kernel-shark: Define a CMAKE_BUILD_TYPE "Package"
@ 2019-07-08  9:19 Yordan Karadzhov (VMware)
  2019-07-08 13:26 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Yordan Karadzhov (VMware) @ 2019-07-08  9:19 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware), Yordan Karadzhov

From: Yordan Karadzhov <ykaradzhov@vmware.com>

A special build type dedicated for package maintainers is added.
By default this build type adds the "-O3" compiler flag. Users
can chose their own compiler flags by providing the corresponding
CMAKE_XXXX_FLAGS_PACKAGE Command-Line options.

If no types is specified, the build type will be "Debug".

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark/CMakeLists.txt | 34 +++++++++++++++++++++++++---------
 kernel-shark/README         | 22 ++++++++++++++++------
 2 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt
index 64124b0..a0535d8 100644
--- a/kernel-shark/CMakeLists.txt
+++ b/kernel-shark/CMakeLists.txt
@@ -36,22 +36,38 @@ set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin")
 set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall -pthread -fPIC")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fPIC")
 
-if(NOT _INSTALL_PREFIX)
-	set(_INSTALL_PREFIX "/usr/local")
-endif()
+if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE Debug)
+endif (NOT CMAKE_BUILD_TYPE)
+
+message("\n Build type: ${CMAKE_BUILD_TYPE}")
+
+if (NOT CMAKE_C_FLAGS_PACKAGE)
+    set(CMAKE_C_FLAGS_PACKAGE "-O3")
+endif (NOT CMAKE_C_FLAGS_PACKAGE)
+
+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 ksharkicon.png)
 
-if (NOT _DEBUG)
+set(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/")
+
+if (CMAKE_BUILD_TYPE MATCHES Package)
+
+    set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
 
-	set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -O2")
-	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
+else (CMAKE_BUILD_TYPE MATCHES Package)
 
-endif (NOT _DEBUG)
+    set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
 
-SET(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/")
-SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+endif (CMAKE_BUILD_TYPE MATCHES Package)
 
 include_directories(${KS_DIR}/src/
                     ${KS_DIR}/build/src/
diff --git a/kernel-shark/README b/kernel-shark/README
index 379c390..75a0dd0 100644
--- a/kernel-shark/README
+++ b/kernel-shark/README
@@ -38,14 +38,24 @@ the original trace-cmd end traceevent libraries.
 2.1.1 In order to create a Doxygen documentation add -D_DOXYGEN_DOC=1
 as a CMake Command-Line option.
 
-2.1.2 In order to generates complete debug information to be used by GDB add
--D_DEBUG=1 as a CMake Command-Line option.
-
-2.1.3 By default, installation prefix is "/usr/local". It can be changed using
+2.1.2 By default, installation prefix is "/usr/local". It can be changed using
 -D_INSTALL_PREFIX= as a CMake Command-Line option.
 
-Example:
-    cmake -D_DOXYGEN_DOC=1 -D_DEBUG=1 -D_INSTALL_PREFIX=/usr ../
+2.1.3 In addition to the standard CMake build types (Debug, Release,
+RelWithDebInfo, MinSizeRel) KernelShark supports a "Package" build type.
+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
+set directly to _INSTALL_PREFIX/lib/kernelshark/
+
+If no build types is specified, the type will be "Debug".
+
+Examples:
+    cmake -D_DOXYGEN_DOC=1 -D_INSTALL_PREFIX=/usr ../
+
+    cmake -DCMAKE_BUILD_TYPE=Package -DCMAKE_C_FLAGS_PACKAGE="-O3 -pedantic"  ../
 
 2.2.1 Use "make clean" if you want to delete all already compiled objects.
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] kernel-shark: Define a CMAKE_BUILD_TYPE "Package"
  2019-07-08  9:19 [PATCH v3] kernel-shark: Define a CMAKE_BUILD_TYPE "Package" Yordan Karadzhov (VMware)
@ 2019-07-08 13:26 ` Steven Rostedt
  2019-07-08 14:02   ` Yordan Karadzhov
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2019-07-08 13:26 UTC (permalink / raw)
  To: Yordan Karadzhov (VMware); +Cc: linux-trace-devel, Yordan Karadzhov

[-- Attachment #1: Type: text/plain, Size: 1367 bytes --]

On Mon,  8 Jul 2019 12:19:45 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> From: Yordan Karadzhov <ykaradzhov@vmware.com>
> 
> A special build type dedicated for package maintainers is added.
> By default this build type adds the "-O3" compiler flag. Users
> can chose their own compiler flags by providing the corresponding
> CMAKE_XXXX_FLAGS_PACKAGE Command-Line options.
> 
> If no types is specified, the build type will be "Debug".
> 
> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
> 

Thanks Yordan!

I applied and pushed most your patches upstream.

I started to play a little with the record feature, and found some
issues.

 1) It still adds a -e'event' for all events when a system is selected.
    Can we just make it use the system? -eirq instead of
    -eirq:irq_handler_entry -eirq:irq_handler_exit -eirq...

 2) When I executed it, it gave me an error, and then crashed
    kernelshark. It should check the status of the run before it tries
    to reload it.

 3) I saved the report as the recorder was still running (but
    kernelshark crashed). And then when I loaded the report (attached)
    it just executed it. The "import" should just pull it in and load
    the settings. This way, one could make updates to a default saved
    record.

These probably should be fixed before ks1.0 is released.

Thanks!

-- Steve

[-- Attachment #2: test-record.json --]
[-- Type: application/json, Size: 5309 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] kernel-shark: Define a CMAKE_BUILD_TYPE "Package"
  2019-07-08 13:26 ` Steven Rostedt
@ 2019-07-08 14:02   ` Yordan Karadzhov
  0 siblings, 0 replies; 3+ messages in thread
From: Yordan Karadzhov @ 2019-07-08 14:02 UTC (permalink / raw)
  To: Steven Rostedt, Yordan Karadzhov (VMware); +Cc: linux-trace-devel



On 8.07.19 г. 16:26 ч., Steven Rostedt wrote:
> On Mon,  8 Jul 2019 12:19:45 +0300
> "Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:
> 
>> From: Yordan Karadzhov <ykaradzhov@vmware.com>
>>
>> A special build type dedicated for package maintainers is added.
>> By default this build type adds the "-O3" compiler flag. Users
>> can chose their own compiler flags by providing the corresponding
>> CMAKE_XXXX_FLAGS_PACKAGE Command-Line options.
>>
>> If no types is specified, the build type will be "Debug".
>>
>> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
>>
> 
> Thanks Yordan!
> 
> I applied and pushed most your patches upstream.
> 
> I started to play a little with the record feature, and found some
> issues.
> 
>   1) It still adds a -e'event' for all events when a system is selected.
>      Can we just make it use the system? -eirq instead of
>      -eirq:irq_handler_entry -eirq:irq_handler_exit -eirq...
> 
>   2) When I executed it, it gave me an error, and then crashed
>      kernelshark. It should check the status of the run before it tries
>      to reload it.
> 
>   3) I saved the report as the recorder was still running (but
>      kernelshark crashed). And then when I loaded the report (attached)
>      it just executed it. The "import" should just pull it in and load
>      the settings. This way, one could make updates to a default saved
>      record.
> 
> These probably should be fixed before ks1.0 is released.
> 

Thanks Steven!

I agree that we have to get these problems fixed before ks1.0. Can we 
have a quick Zoom now, because I am not sure I understand the sequence 
of actions (in 2 and 3) that made it crashing.

Thanks!
Yordan

> Thanks!
> 
> -- Steve
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-08 14:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08  9:19 [PATCH v3] kernel-shark: Define a CMAKE_BUILD_TYPE "Package" Yordan Karadzhov (VMware)
2019-07-08 13:26 ` Steven Rostedt
2019-07-08 14:02   ` Yordan Karadzhov

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).