Skip to contentSkip to conversation

Fixes needed for KS 1.1

PATCH In review Yordan Karadzhov (VMware) 1 participant 6 messages Sep 20, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Fixes needed for KS 1.1

Yordan Karadzhov (VMware) (4):
kernel-shark: Use correct order when linking all depenancies
trace-cmd: Correct the install paths of traceevent and trace-cmd
libraries
kernel-shark: Fix the file paths used by Doxygen
kernel-shark: Cleanup in KsCaptureDialog

 Makefile                                      |  8 +++----
 kernel-shark/Documentation/doxygen/dox_config |  4 ++--
 kernel-shark/src/CMakeLists.txt               | 16 +++++++-------
 kernel-shark/src/KsCaptureDialog.cpp          | 21 ++++++++++---------
 kernel-shark/src/KsCaptureDialog.hpp          |  2 --
 5 files changed, 25 insertions(+), 26 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/4 kernel-shark: Use correct order when linking all depenancies

I wasn't aware of the importance of the order in which the libraries are passed to the linker, so in the dependency list in src/CMakeLists.txt I naively started with the most basic libraries first. This is WRONG. The linker searches and resolves symbols in the order that they appear. If library A contains a call to a function from library B, we have to put A before B, otherwise the linker won't know that something in B needs to be resolved.

---
 kernel-shark/src/CMakeLists.txt | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
kernel-shark/src/CMakeLists.txt +8 -8
index 21494cc..e20a030 100644
@@ -7,10 +7,10 @@ add_library(kshark SHARED libkshark.c
                           libkshark-configio.c
                           libkshark-collection.c)
 
-target_link_libraries(kshark ${CMAKE_DL_LIBS}
+target_link_libraries(kshark ${TRACEEVENT_LIBRARY}
+                             ${TRACECMD_LIBRARY}
                              ${JSONC_LIBRARY}
-                             ${TRACEEVENT_LIBRARY}
-                             ${TRACECMD_LIBRARY})
+                             ${CMAKE_DL_LIBS})
 
 set_target_properties(kshark  PROPERTIES SUFFIX	".so.${KS_VERSION_STRING}")
 
@@ -23,8 +23,8 @@ if (OPENGL_FOUND AND GLUT_FOUND)
                                      KsPlotTools.cpp)
 
     target_link_libraries(kshark-plot  kshark
-                                       ${OPENGL_LIBRARIES}
-                                       ${GLUT_LIBRARY})
+                                       ${GLUT_LIBRARY}
+                                       ${OPENGL_LIBRARIES})
 
     set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
 
@@ -65,11 +65,11 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
                                                             KsAdvFilteringDialog.cpp)
 
     target_link_libraries(kshark-gui kshark-plot
-                                     ${CMAKE_DL_LIBS}
+                                     Qt5::Widgets
+                                     Qt5::Network
                                      ${TRACEEVENT_LIBRARY}
                                      ${TRACECMD_LIBRARY}
-                                     Qt5::Widgets
-                                     Qt5::Network)
+                                     ${CMAKE_DL_LIBS})
 
     set_target_properties(kshark-gui PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
 
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/4 trace-cmd: Correct the install paths of traceevent and trace-cmd libraries

In reply to Yordan Karadzhov (VMware)

In order to be able to use the installed versions of the library's headers (and the libraries itself) the directories structure of the source has to be reprodused in the install location.

This modification is needed by the NumPy interface of KernelShark.

---
 Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Makefile +4 -4
index dabdf8d..7124b2f 100644
@@ -344,12 +344,12 @@ install_gui: install_cmd gui
 	$(Q)$(MAKE) $(S) -C $(kshark-dir)/build install
 
 install_libs: libs
-	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ))
-	$(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ))
+	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ)/trace-cmd)
+	$(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ)/traceevent)
 	$(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)/traceevent)
 	$(Q)$(call do_install,$(src)/include/traceevent/trace-seq.h,$(includedir_SQ)/traceevent)
-	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ))
-	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-filter-hash.h,$(includedir_SQ))
+	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd)
+	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-filter-hash.h,$(includedir_SQ)/trace-cmd)
 
 doc:
 	$(MAKE) -C $(src)/Documentation all
Signature · 1 line
2.20.1
#3 lore raw

Re: [PATCH 2/4] trace-cmd: Correct the install paths of traceevent and trace-cmd libraries

This one is wrong. Please ignore it.
I am sending v2.

Thanks!
Yordan

Quoted 33 lines · Yordan Karadzhov (VMware)

In order to be able to use the installed versions of the library's headers (and the libraries itself) the directories structure of the source has to be reprodused in the install location.

This modification is needed by the NumPy interface of KernelShark.

---
  Makefile | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
Makefile +4 -4
index dabdf8d..7124b2f 100644
@@ -344,12 +344,12 @@ install_gui: install_cmd gui
  	$(Q)$(MAKE) $(S) -C $(kshark-dir)/build install
 
  install_libs: libs
-	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ))
-	$(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ))
+	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ)/trace-cmd)
+	$(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ)/traceevent)
  	$(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)/traceevent)
  	$(Q)$(call do_install,$(src)/include/traceevent/trace-seq.h,$(includedir_SQ)/traceevent)
-	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ))
-	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-filter-hash.h,$(includedir_SQ))
+	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd)
+	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-filter-hash.h,$(includedir_SQ)/trace-cmd)
 
  doc:
  	$(MAKE) -C $(src)/Documentation all
#4 lore raw

PATCH 3/4 kernel-shark: Fix the file paths used by Doxygen

In reply to Yordan Karadzhov (VMware)

The Doxygen documentation, including its configuration file, have been moved to another directory. Therefore the paths, used by Doxygen to find its input, have to be changed accordingly.

Fixes d4d68c9 (kernel-shark: Separate trace-cmd and kernelshark)
---
 kernel-shark/Documentation/doxygen/dox_config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel-shark/Documentation/doxygen/dox_config +2 -2
index 43c7f84..89b9284 100644
@@ -4,7 +4,7 @@
 DOXYFILE_ENCODING      = UTF-8
 PROJECT_NAME           = "KernelShark"
 PROJECT_BRIEF = "Kernel Shark is a front-end reader of the Linux kernel tracing data."
-INPUT                  = ../src/ ../src/plugins/
+INPUT                  = ../../src/ ../../src/plugins/
 SOURCE_BROWSER         = YES
 QT_AUTOBRIEF           = YES
 TAB_SIZE               = 8
@@ -13,4 +13,4 @@ CASE_SENSE_NAMES       = YES
 SORT_MEMBER_DOCS       = NO
 STRICT_PROTO_MATCHING  = YES
 DOT_MULTI_TARGETS      = YES
-PROJECT_LOGO           = ../icons/KS_logo_stacked.svg
+PROJECT_LOGO           = ../../icons/KS_logo_stacked.svg
Signature · 1 line
2.20.1
#5 lore raw

PATCH 4/4 kernel-shark: Cleanup in KsCaptureDialog

In reply to Yordan Karadzhov (VMware)

My original intend was to fix a Doxygen warning complaining about a data member of a class not being documented. However, when I tried to write explanation for this data member (KsCaptureMonitor::_captureStatus), I realized that it is completely useless and that it actually violates the encapsulation principle, since it holds the return status of the capture process, but the capture process itself is owned by another class (KsCaptureDialog).

---
 kernel-shark/src/KsCaptureDialog.cpp | 21 +++++++++++----------
 kernel-shark/src/KsCaptureDialog.hpp |  2 --
 2 files changed, 11 insertions(+), 12 deletions(-)
kernel-shark/src/KsCaptureDialog.cpp +11 -10
index fff42aa..ad05917 100644
@@ -385,7 +385,6 @@ KsCaptureMonitor::KsCaptureMonitor(QWidget *parent)
 : QWidget(parent),
   _mergedChannels(false),
   _argsModified(false),
-  _captureStatus(false),
   _panel(this),
   _name("Output display", this),
   _space("max size ", this),
@@ -523,9 +522,6 @@ void KsCaptureMonitor::_captureFinished(int exit, QProcess::ExitStatus status)
 		_consolOutput.appendPlainText(errMessage);
 
 		QCoreApplication::processEvents();
-		_captureStatus = false;
-	} else {
-		_captureStatus = true;
 	}
 }
 
@@ -585,6 +581,17 @@ void KsCaptureDialog::_capture()
 	_captureProc.start();
 	_captureProc.waitForFinished();
 
+	/* Reset the _argsModified flag. */
+	_captureMon._argsModified = false;
+
+	if (_captureProc.exitCode() != 0 ||
+	    _captureProc.exitStatus() != QProcess::NormalExit)
+		return;
+
+	/*
+	 * Capture finished successfully. Open the produced tracing data file
+	 * in KernelShark.
+	 */
 	argc = argv.count();
 	for (int i = 0; i < argc; ++i) {
 		if (argv[i] == "-o") {
@@ -592,9 +599,6 @@ void KsCaptureDialog::_capture()
 			break;
 		}
 	}
-
-	/* Reset the _argsModified flag. */
-	_captureMon._argsModified = false;
 }
 
 void KsCaptureDialog::_setChannelMode(int state)
@@ -610,9 +614,6 @@ void KsCaptureDialog::_sendOpenReq(const QString &fileName)
 {
 	QLocalSocket *socket;
 
-	if (!_captureMon._captureStatus)
-		return;
-
 	socket = new QLocalSocket(this);
 	socket->connectToServer("KSCapture", QIODevice::WriteOnly);
 	if (socket->waitForConnected()) {
kernel-shark/src/KsCaptureDialog.hpp +0 -2
index 612080c..3fd3d8d 100644
@@ -141,8 +141,6 @@ public:
 	 */
 	bool		_argsModified;
 
-	bool		_captureStatus;
-
 private:
 	QVBoxLayout	_layout;
 
Signature · 1 line
2.20.1