Skip to contentSkip to conversation

Add basic components to be used by the Qt GUI

PATCH Superseded Yordan Karadzhov 2 participants 6 messages Oct 11, 2018

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add basic components to be used by the Qt GUI

This series of patches introduces the first components of the Qt-based KernelShark GUI. It includes some basic utils, as well as various small widgets and dialogues used by the GUI. The GUI itself will be introdused in the following series.

Yordan Karadzhov (VMware) (4):
kernel-shark-qt: Add Qt as a third party dependency.
kernel-shark-qt: Add KernalShark Utils
kernel-shark-qt: Add Widgets Lib
kernel-shark-qt: Add widget demo example.

 kernel-shark-qt/CMakeLists.txt          |   8 +
 kernel-shark-qt/README                  |   6 +-
 kernel-shark-qt/build/deff.h.cmake      |  16 +
 kernel-shark-qt/examples/CMakeLists.txt |   4 +
 kernel-shark-qt/examples/widgetdemo.cpp | 158 +++++
 kernel-shark-qt/src/CMakeLists.txt      |  22 +
 kernel-shark-qt/src/KsUtils.cpp         | 594 ++++++++++++++++
 kernel-shark-qt/src/KsUtils.hpp         | 233 +++++++
 kernel-shark-qt/src/KsWidgetsLib.cpp    | 878 ++++++++++++++++++++++++
 kernel-shark-qt/src/KsWidgetsLib.hpp    | 385 +++++++++++
 10 files changed, 2303 insertions(+), 1 deletion(-)
 create mode 100644 kernel-shark-qt/examples/widgetdemo.cpp
 create mode 100644 kernel-shark-qt/src/KsUtils.cpp
 create mode 100644 kernel-shark-qt/src/KsUtils.hpp
 create mode 100644 kernel-shark-qt/src/KsWidgetsLib.cpp
 create mode 100644 kernel-shark-qt/src/KsWidgetsLib.hpp
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/4 kernel-shark-qt: Add Qt as a third party dependency.

From: Yordan Karadzhov (VMware) <[email protected]>

This patch prepares the Cmake build infrastructure for the introduction of a KernelShark GUI, baset on Qt.

---
 kernel-shark-qt/CMakeLists.txt | 8 ++++++++
 kernel-shark-qt/README         | 6 +++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
kernel-shark-qt/CMakeLists.txt +8 -0
index 4a40b11..71a021e 100644
@@ -20,6 +20,14 @@ find_package(Doxygen)
 find_package(OpenGL)
 find_package(GLUT)
 
+find_package(Qt5Widgets 5.7.1)
+find_package(Qt5Network)
+if (Qt5Widgets_FOUND)
+
+    message(STATUS "Found Qt5Widgets:  (version ${Qt5Widgets_VERSION})")
+
+endif (Qt5Widgets_FOUND)
+
 set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/lib")
 set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin")
 
kernel-shark-qt/README +5 -1
index 84708bd..14bcb77 100644
@@ -4,10 +4,13 @@ This directory contains the new Qt-based version of the KernelShark GUI.
 
 Third Party Software:
 ------------------------------------------------------------
-The external dependencies:
+KernelShark has the following external dependencies:
+  Cmake, Json-C, OpenGL/Glut, Qt5Base.
+
 1. In order to install the packages on Ubuntu do the following:
     sudo apt-get install build-essential git cmake libjson-c-dev -y
     sudo apt-get install freeglut3-dev libxmu-dev libxi-dev -y
+    sudo apt-get install qtbase5-dev -y
 
 1.1 I you want to be able to generate Doxygen documentation:
     sudo apt-get install graphviz doxygen-gui -y
@@ -16,6 +19,7 @@ The external dependencies:
 2. In order to install the packages on Fedora, as root do the following:
     dnf install gcc gcc-c++ git cmake json-c-devel -y
     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:
     dnf install graphviz doxygen -y
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/4 kernel-shark-qt: Add KernalShark Utils

In reply to Yordan Karadzhov

From: Yordan Karadzhov (VMware) <[email protected]>

This patch introduces the kshark-gui library and defines some basic components, like Data Store and Plugin Manager, used under the hood of the KernelShark GUI.

---
 kernel-shark-qt/build/deff.h.cmake |  16 +
 kernel-shark-qt/src/CMakeLists.txt |  20 +
 kernel-shark-qt/src/KsUtils.cpp    | 594 +++++++++++++++++++++++++++++
 kernel-shark-qt/src/KsUtils.hpp    | 233 +++++++++++
 4 files changed, 863 insertions(+)
 create mode 100644 kernel-shark-qt/src/KsUtils.cpp
 create mode 100644 kernel-shark-qt/src/KsUtils.hpp
kernel-shark-qt/build/deff.h.cmake +16 -0
index 44ea08b..d1a1bb7 100644
@@ -14,7 +14,23 @@
 /** KernelShark source code path. */
 #cmakedefine KS_DIR "@KS_DIR@"
 
+/** KernelShark configuration directory path. */
+#cmakedefine KS_CONF_DIR "@KS_CONF_DIR@"
+
 /** Location of the trace-cmd executable. */
 #cmakedefine TRACECMD_BIN_DIR "@TRACECMD_BIN_DIR@"
 
+#ifdef __cplusplus
+
+	#include <QString>
+
+	/**
+	 * String containing semicolon-separated list of plugin names.
+	 * The plugins to be loaded when KernelShark starts are tagged
+	 * with "default".
+	 */
+	const QString plugins = "@PLUGINS@";
+
+#endif /* __cplusplus */
+
 #endif // _KS_CONFIG_H
kernel-shark-qt/src/CMakeLists.txt +20 -0
index 305cea7..e897e9a 100644
@@ -28,6 +28,26 @@ if (OPENGL_FOUND AND GLUT_FOUND)
 
 endif (OPENGL_FOUND AND GLUT_FOUND)
 
+if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
+
+    message(STATUS "libkshark-gui")
+    set (ks-guiLib_hdr  KsUtils.hpp)
+
+    QT5_WRAP_CPP(ks-guiLib_hdr_moc ${ks-guiLib_hdr})
+
+    add_library(kshark-gui  SHARED  ${ks-guiLib_hdr_moc}    KsUtils.cpp)
+
+    target_link_libraries(kshark-gui kshark-plot
+                                     ${CMAKE_DL_LIBS}
+                                     ${TRACEEVENT_LIBRARY}
+                                     ${TRACECMD_LIBRARY}
+                                     Qt5::Widgets
+                                     Qt5::Network)
+
+    set_target_properties(kshark-gui PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
+
+endif (Qt5Widgets_FOUND AND Qt5Network_FOUND)
+
 add_subdirectory(plugins)
 
 configure_file( ${KS_DIR}/build/deff.h.cmake
kernel-shark-qt/src/KsUtils.cpp new file +594 -0

594 lines not on this page · raw message

kernel-shark-qt/src/KsUtils.hpp new file +233 -0

233 lines not on this page · raw message

Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 3/4 kernel-shark-qt: Add Widgets Lib

In reply to Yordan Karadzhov

From: Yordan Karadzhov (VMware) <[email protected]>

This patch defines various small widgets and dialogues to be used by the KernelShark GUI.

---
 kernel-shark-qt/src/CMakeLists.txt   |   6 +-
 kernel-shark-qt/src/KsWidgetsLib.cpp | 878 +++++++++++++++++++++++++++
 kernel-shark-qt/src/KsWidgetsLib.hpp | 385 ++++++++++++
 3 files changed, 1267 insertions(+), 2 deletions(-)
 create mode 100644 kernel-shark-qt/src/KsWidgetsLib.cpp
 create mode 100644 kernel-shark-qt/src/KsWidgetsLib.hpp
kernel-shark-qt/src/CMakeLists.txt +4 -2
index e897e9a..2ac79ca 100644
@@ -31,11 +31,13 @@ endif (OPENGL_FOUND AND GLUT_FOUND)
 if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
 
     message(STATUS "libkshark-gui")
-    set (ks-guiLib_hdr  KsUtils.hpp)
+    set (ks-guiLib_hdr  KsUtils.hpp
+                        KsWidgetsLib.hpp)
 
     QT5_WRAP_CPP(ks-guiLib_hdr_moc ${ks-guiLib_hdr})
 
-    add_library(kshark-gui  SHARED  ${ks-guiLib_hdr_moc}    KsUtils.cpp)
+    add_library(kshark-gui  SHARED  ${ks-guiLib_hdr_moc}    KsUtils.cpp
+                                                            KsWidgetsLib.cpp)
 
     target_link_libraries(kshark-gui kshark-plot
                                      ${CMAKE_DL_LIBS}
kernel-shark-qt/src/KsWidgetsLib.cpp new file +878 -0

878 lines not on this page · raw message

kernel-shark-qt/src/KsWidgetsLib.hpp new file +385 -0

385 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

PATCH v2 4/4 kernel-shark-qt: Add widget demo example.

In reply to Yordan Karadzhov

From: Yordan Karadzhov (VMware) <[email protected]>

This patch introduces a basic example, showing how to use KsUtils and KsWidgetsLib.

---
 kernel-shark-qt/examples/CMakeLists.txt |   4 +
 kernel-shark-qt/examples/widgetdemo.cpp | 158 ++++++++++++++++++++++++
 2 files changed, 162 insertions(+)
 create mode 100644 kernel-shark-qt/examples/widgetdemo.cpp
kernel-shark-qt/examples/CMakeLists.txt +4 -0
index 0c83293..e16216e 100644
@@ -19,3 +19,7 @@ target_link_libraries(confio   kshark)
 message(STATUS "dataplot")
 add_executable(dplot          dataplot.cpp)
 target_link_libraries(dplot   kshark-plot)
+
+message(STATUS "widgetdemo")
+add_executable(widgetdemo          widgetdemo.cpp)
+target_link_libraries(widgetdemo   kshark-gui)
kernel-shark-qt/examples/widgetdemo.cpp new file +158 -0

158 lines not on this page · raw message

Signature · 1 line
2.17.1
#5 lore raw
In reply to Yordan Karadzhov
Quoted 10 lines · On Wed, 10 Oct 2018 23:10:11 +0300 Yordan Karadzhov <[email protected]>…

This series of patches introduces the first components of the Qt-based KernelShark GUI. It includes some basic utils, as well as various small widgets and dialogues used by the GUI. The GUI itself will be introdused in the following series.

Yordan Karadzhov (VMware) (4):
kernel-shark-qt: Add Qt as a third party dependency.
kernel-shark-qt: Add KernalShark Utils
kernel-shark-qt: Add Widgets Lib
kernel-shark-qt: Add widget demo example.

The series looks good, but there's one problem. I've applied Tzvetomir's latest patch that abstracts tep_handle, and causes your code now to not build.

Can you pull my latest code and rebase these patches (I see nothing wrong wtih them), but make sure they build at each step?

Thanks!

-- Steve

Quoted 18 lines
 kernel-shark-qt/CMakeLists.txt          |   8 +
 kernel-shark-qt/README                  |   6 +-
 kernel-shark-qt/build/deff.h.cmake      |  16 +
 kernel-shark-qt/examples/CMakeLists.txt |   4 +
 kernel-shark-qt/examples/widgetdemo.cpp | 158 +++++
 kernel-shark-qt/src/CMakeLists.txt      |  22 +
 kernel-shark-qt/src/KsUtils.cpp         | 594 ++++++++++++++++
 kernel-shark-qt/src/KsUtils.hpp         | 233 +++++++
 kernel-shark-qt/src/KsWidgetsLib.cpp    | 878 ++++++++++++++++++++++++
 kernel-shark-qt/src/KsWidgetsLib.hpp    | 385 +++++++++++
 10 files changed, 2303 insertions(+), 1 deletion(-)
 create mode 100644 kernel-shark-qt/examples/widgetdemo.cpp
 create mode 100644 kernel-shark-qt/src/KsUtils.cpp
 create mode 100644 kernel-shark-qt/src/KsUtils.hpp
 create mode 100644 kernel-shark-qt/src/KsWidgetsLib.cpp
 create mode 100644 kernel-shark-qt/src/KsWidgetsLib.hpp