Skip to contentSkip to conversation

Various minor modifications and fixes toward KS 2.0

PATCH In review Yordan Karadzhov (VMware) 2 participants 6 messages Apr 21, 2021

lore
Share & tools
lore
#0 lore raw

cover Various minor modifications and fixes toward KS 2.0

Yordan Karadzhov (VMware) (4):
kernel-shark: Fix warnings from deprecated Qt APIs
kernel-shark: Polish the README file
kernel-shark: Exclude libkshark-plot from libkshark-devel
kernel-shark: Integrate install_libkshark-devel.sh

 README                           | 42 ++++++++++++++++++++------------
 build/install_libkshark-devel.sh |  6 ++++-
 src/CMakeLists.txt               | 13 ++--------
 src/KsTraceGraph.cpp             |  9 +++++--
 src/KsWidgetsLib.cpp             | 14 +++++------
 5 files changed, 48 insertions(+), 36 deletions(-)
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/4 kernel-shark: Fix warnings from deprecated Qt APIs

Couple of APIs used by KernelShark have been marked as deprecated in the recent version of Qt. Fix all compilation warnings caused by the usage of these deprecated APIs.

---
 src/KsTraceGraph.cpp |  9 +++++++--
 src/KsWidgetsLib.cpp | 14 +++++++-------
 2 files changed, 14 insertions(+), 9 deletions(-)
src/KsTraceGraph.cpp +7 -2
index fd9cfac..1e976df 100644
@@ -327,13 +327,18 @@ void KsTraceGraph::_setPointerInfo(size_t i)
 	QString aux(lanMakeString(kshark_get_aux_info(e)));
 	QString info(lanMakeString(kshark_get_info(e)));
 	QString comm(lanMakeString(kshark_get_task(e)));
-	QString pointer, elidedText;
+	QString elidedText;
 	int labelWidth;
 	uint64_t sec, usec;
+	char *pointer;
 
 	kshark_convert_nano(e->ts, &sec, &usec);
-	pointer.sprintf("%" PRIu64 ".%06" PRIu64 "", sec, usec);
+	labelWidth = asprintf(&pointer, "%" PRIu64 ".%06" PRIu64 "", sec, usec);
+	if (labelWidth <= 0)
+		return;
+
 	_labelP2.setText(pointer);
+	free(pointer);
 
 	comm.append("-");
 	comm.append(QString("%1").arg(kshark_get_pid(e)));
src/KsWidgetsLib.cpp +7 -7
index 4ec6033..e30bf27 100644
@@ -926,9 +926,9 @@ KsCPUCheckBoxWidget::KsCPUCheckBoxWidget(kshark_data_stream *stream, QWidget *pa
 		cpuItem->setText(0, "  ");
 		cpuItem->setText(1, QString("CPU %1").arg(i));
 		cpuItem->setCheckState(0, Qt::Checked);
-		cpuItem->setBackgroundColor(0, QColor(colors[i].r(),
-						      colors[i].g(),
-						      colors[i].b()));
+		cpuItem->setBackground(0, QColor(colors[i].r(),
+						 colors[i].g(),
+						 colors[i].b()));
 		_tree.addTopLevelItem(cpuItem);
 		_id[i] = i;
 		_cb[i] = cpuItem;
@@ -1115,12 +1115,12 @@ KsTasksCheckBoxWidget::KsTasksCheckBoxWidget(kshark_data_stream *stream,
 
 		comItem = new QTableWidgetItem(tr(comm));
 
-		pidItem->setBackgroundColor(QColor(colors[pid].r(),
-						   colors[pid].g(),
-						   colors[pid].b()));
+		pidItem->setBackground(QColor(colors[pid].r(),
+					      colors[pid].g(),
+					      colors[pid].b()));
 
 		if (_id[i] == 0)
-			pidItem->setTextColor(Qt::white);
+			pidItem->setForeground(Qt::white);
 
 		_table.setItem(i, 2, comItem);
 	}
Signature · 1 line
2.27.0
#2 lore raw

PATCH 2/4 kernel-shark: Polish the README file

In reply to Yordan Karadzhov (VMware)

Fixing some typos and making it easier to read.

---
 README | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
README +17 -15
index f5035f9..b1934c3 100644
@@ -7,7 +7,8 @@ The official repository is here:
 Third Party Software:
 ------------------------------------------------------------
 KernelShark has the following external dependencies:
-  Cmake, Json-C, OpenGL/Glut, Qt5Base, libtraceevent, libtracefs, trace-cmd.
+  Cmake, Json-C, OpenGL/Glut, Qt5Base, libtraceevent, libtracefs, trace-cmd
+  and FreeSans font.
 
 1. In order to install the packages on Ubuntu do the following:
     sudo apt-get install build-essential git cmake libjson-c-dev -y
@@ -15,7 +16,7 @@ KernelShark has the following external dependencies:
     sudo apt-get install fonts-freefont-ttf
     sudo apt-get install qtbase5-dev -y
 
-1.1 I you want to be able to generate Doxygen documentation:
+1.1 If you want to be able to generate Doxygen documentation:
     sudo apt-get install graphviz doxygen-gui -y
 
 
@@ -24,7 +25,7 @@ KernelShark has the following external dependencies:
     dnf install freeglut-devel redhat-rpm-config -y
     dnf install qt5-qtbase-devel -y
 
-2.1 I you want to be able to generate Doxygen documentation:
+2.1 If you want to be able to generate Doxygen documentation:
     dnf install graphviz doxygen -y
 
 
@@ -46,26 +47,27 @@ KernelShark has the following external dependencies:
 
 Building:
 ------------------------------------------------------------
-2. Building KernelShark:
+1. Building and install KernelShark GUI:
 
     cd kernel-shark/build
     cmake ../
     make
     sudo ./install_gui.sh
 
-2.1 In order to create a Doxygen documentation add -D_DOXYGEN_DOC=1
-as a CMake Command-Line option.
+1.1 In order to create a Doxygen documentation add -D_DOXYGEN_DOC=1
+as a CMake Command-Line option (see the example below).
 
-2.2 KernelShark has multiple build types. By default, the build type is
+1.2 KernelShark has multiple build types. By default, the build type is
 RelWithDebInfo, which will build a release candidate with debug information.
-To change the type, pass in the option CMAKE_BUILD_TYPE=<type>.
+To change the type, pass in the option CMAKE_BUILD_TYPE=<type> (see the
+example below).
 
     cmake -DCMAKE_BUILD_TYPE=Debug           - for "-g" option
     cmake -DCMAKE_BUILD_TYPE=Release         - for "-O3" option
     cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo  - for "-g -O2" option (default)
     cmake -DCMAKE_BUILD_TYPE=MinSizeRel      - for "-Os" option
 
-2.3 In addition to the standard CMake build types (Debug, Release,
+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 "-O3" compiler flag. Package maintainers
 can chose their own compiler flags by providing the corresponding
@@ -74,19 +76,19 @@ 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/
 
-2.4 After building the code "kernel-shark/lib" will contain all libraries
+1.4 After building the code "kernel-shark/lib" will contain all libraries
 and "kernel-shark/bin" will contain all executables.
 
-2.5 Use the script "cmake_clean.sh" if you want to delete all already
+1.5 Use the script "cmake_clean.sh" if you want to delete all already
 compiled objects and all files generated by CMake.
 
     cd kernel-shark/build
-    ./cmake-clean.sh
+    ./cmake_clean.sh
 
-2.6 By default, installation prefix is "/usr/local". It can be changed using
--D_INSTALL_PREFIX= as a CMake Command-Line option.
+1.6 By default, installation prefix is "/usr/local". It can be changed using
+-D_INSTALL_PREFIX= as a CMake Command-Line option (see the example below).
 
-2.7 In order to uninstall KernelShark do:
+1.7 In order to uninstall KernelShark do:
     cd kernel-shark/build
     ./cmake_uninstall.sh
 
Signature · 1 line
2.27.0
#3 lore raw

PATCH 3/4 kernel-shark: Exclude libkshark-plot from libkshark-devel

In reply to Yordan Karadzhov (VMware)

The library that provides the OpenGL plotting instruments, used by the KernelShark GUI is remove from the "libkshark-devel" installation component. In fact this library was never a true (functional) part of "libkshark-devel", since its header files were never installed.

---
 src/CMakeLists.txt | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
src/CMakeLists.txt +2 -11
index 4ab0af2..f3c4e0a 100644
@@ -21,7 +21,6 @@ set_target_properties(kshark  PROPERTIES
                                   SOVERSION ${KS_VERSION_MAJOR}
                                   VERSION   ${KS_VERSION_STRING})
 
-
 install(TARGETS kshark
         LIBRARY DESTINATION    ${_LIBDIR}
             COMPONENT              kernelshark
@@ -58,18 +57,10 @@ if (OPENGL_FOUND)
                                        ${GLUT_LIBRARY}
                                        ${OPENGL_LIBRARIES})
 
-    set_target_properties(kshark-plot PROPERTIES
-                                          SOVERSION ${KS_VERSION_MAJOR}
-                                          VERSION   ${KS_VERSION_STRING})
-
+    set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
     install(TARGETS kshark-plot
             LIBRARY DESTINATION    ${_LIBDIR}
-                COMPONENT              kernelshark
-                NAMELINK_COMPONENT     libkshark-devel
-            INCLUDES DESTINATION   ${_INSTALL_PREFIX}/include/${KS_APP_NAME}
-                COMPONENT              libkshark-devel
-            ARCHIVE DESTINATION    ${_LIBDIR}
-                COMPONENT              libkshark-devel)
+                COMPONENT              kernelshark)
 
 endif (OPENGL_FOUND)
 
Signature · 1 line
2.27.0
#4 lore raw

PATCH 4/4 kernel-shark: Integrate install_libkshark-devel.sh

In reply to Yordan Karadzhov (VMware)

So far "install_libkshark-devel.sh" was an unofficial script that was used to help installing the "libkshark-devel" component. It was introduced, because the CMake syntax for doing this is quite hard to memorize. Here we make this script an integrated part of the build system. The message output is made consistent with the messages printed by "install_gui.sh". The usage of the script is explained in README.

---
 README                           | 12 +++++++++++-
 build/install_libkshark-devel.sh |  6 +++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
README +11 -1
index b1934c3..652891c 100644
@@ -88,7 +88,17 @@ compiled objects and all files generated by CMake.
 1.6 By default, installation prefix is "/usr/local". It can be changed using
 -D_INSTALL_PREFIX= as a CMake Command-Line option (see the example below).
 
-1.7 In order to uninstall KernelShark do:
+2. To install libkshark-devel do:
+    sudo ./install_libkshark-devel.sh
+
+    This will install all components needed in order to use "libkshark".
+    Note that if you just use:
+
+    sudo make install
+
+    this will install both the GUI and libkshark-devel.
+
+3.  In order to uninstall KernelShark (no matter what has been installed) do:
     cd kernel-shark/build
     ./cmake_uninstall.sh
 
build/install_libkshark-devel.sh +5 -1
index a7e420d..b20fca0 100755
@@ -1 +1,5 @@
-sudo cmake -DCOMPONENT=libkshark-devel -P cmake_install.cmake
+if cmake -DCOMPONENT=libkshark-devel -P cmake_install.cmake; then
+    echo "libkshark-devel installed correctly"
+else
+        exit 1
+fi
Signature · 1 line
2.27.0
Acked-by on the v1 series
#5 lore raw
In reply to Yordan Karadzhov (VMware)
Quoted 6 lines · On Wed, 21 Apr 2021 17:51:36 +0300 "Yordan Karadzhov (VMware)"…

Yordan Karadzhov (VMware) (4):
kernel-shark: Fix warnings from deprecated Qt APIs
kernel-shark: Polish the README file
kernel-shark: Exclude libkshark-plot from libkshark-devel
kernel-shark: Integrate install_libkshark-devel.sh

Quoted 7 lines
 README                           | 42 ++++++++++++++++++++------------
 build/install_libkshark-devel.sh |  6 ++++-
 src/CMakeLists.txt               | 13 ++--------
 src/KsTraceGraph.cpp             |  9 +++++--
 src/KsWidgetsLib.cpp             | 14 +++++------
 5 files changed, 48 insertions(+), 36 deletions(-)

All look reasonable to me.

Thanks Yordan!

-- Steve