Skip to contentSkip to conversation

Add drawing instrumentation to be used by the Qt-based KernelShark

PATCH In review Yordan Karadzhov (VMware) 2 participants 6 messages Aug 28, 2018 – Aug 29, 2018

lore
Share & tools
lore
#0 lore raw

v3 cover Add drawing instrumentation to be used by the Qt-based KernelShark

The KernelShark plotting library is introduced in this series of patches. The library will be used by the GUI to draw CPU and Task Graphs. This is also the first time KernelShark enters the world of C++.

This is the 3th version of this series of patches. The major change from v2 is the debugging of the example ([PATCH 3/4]).

Yordan Karadzhov (VMware) (4):
kernel-shark-qt: Add OpenGL/GLUT as a third party dependency.
kernel-shark-qt: Add basic instruments for OpenGL plotting.
kernel-shark-qt: Add C++ API for drawing of Graphs
kernel-shark-qt: Add an example showing how to draw shapes and Graphs.

 kernel-shark-qt/CMakeLists.txt          |    3 +
 kernel-shark-qt/README                  |    2 +
 kernel-shark-qt/examples/CMakeLists.txt |    4 +
 kernel-shark-qt/examples/dataplot.cpp   |  231 +++++
 kernel-shark-qt/src/CMakeLists.txt      |   14 +
 kernel-shark-qt/src/KsPlotTools.cpp     | 1123 +++++++++++++++++++++++
 kernel-shark-qt/src/KsPlotTools.hpp     |  485 ++++++++++
 kernel-shark-qt/src/libkshark-plot.c    |  212 +++++
 kernel-shark-qt/src/libkshark-plot.h    |   69 ++
 9 files changed, 2143 insertions(+)
 create mode 100644 kernel-shark-qt/examples/dataplot.cpp
 create mode 100644 kernel-shark-qt/src/KsPlotTools.cpp
 create mode 100644 kernel-shark-qt/src/KsPlotTools.hpp
 create mode 100644 kernel-shark-qt/src/libkshark-plot.c
 create mode 100644 kernel-shark-qt/src/libkshark-plot.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH v3 1/4 kernel-shark-qt: Add OpenGL/GLUT as a third party dependency.

This patch prepares the Cmake build infrastructure for the introduction of a KernelShark Ploting library, baset on OpenGl. The Ploting library will be added in the following patch.

---
 kernel-shark-qt/CMakeLists.txt | 3 +++
 kernel-shark-qt/README         | 2 ++
 2 files changed, 5 insertions(+)
kernel-shark-qt/CMakeLists.txt +3 -0
index 3516caa..0187eb4 100644
@@ -17,6 +17,9 @@ include(${KS_DIR}/build/FindJSONC.cmake)
 
 find_package(Doxygen)
 
+find_package(OpenGL)
+find_package(GLUT)
+
 set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/lib")
 set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin")
 
kernel-shark-qt/README +2 -0
index e6818fc..f03288c 100644
@@ -7,6 +7,7 @@ Third Party Software:
 The external dependencies:
 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
 
 1.1 I you want to be able to generate Doxygen documentation:
     sudo apt-get install graphviz doxygen-gui -y
@@ -14,6 +15,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
 
 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 v3 2/4 kernel-shark-qt: Add basic instruments for OpenGL plotting.

In reply to Yordan Karadzhov (VMware)

This patch introduces tools for initializing OpenGL and for drawing the three basic geometrical primitives (point, line and polygon) used when plotting KernelShark's graphs.

---
 kernel-shark-qt/src/CMakeLists.txt   |  13 ++
 kernel-shark-qt/src/libkshark-plot.c | 212 +++++++++++++++++++++++++++
 kernel-shark-qt/src/libkshark-plot.h |  69 +++++++++
 3 files changed, 294 insertions(+)
 create mode 100644 kernel-shark-qt/src/libkshark-plot.c
 create mode 100644 kernel-shark-qt/src/libkshark-plot.h
kernel-shark-qt/src/CMakeLists.txt +13 -0
index a762da1..9c74bc0 100644
@@ -13,5 +13,18 @@ target_link_libraries(kshark ${CMAKE_DL_LIBS}
 
 set_target_properties(kshark  PROPERTIES SUFFIX	".so.${KS_VERSION_STRING}")
 
+if (OPENGL_FOUND AND GLUT_FOUND)
+
+    message(STATUS "libkshark-plot")
+    add_library(kshark-plot  SHARED  libkshark-plot.c)
+
+    target_link_libraries(kshark-plot  kshark
+                                       ${OPENGL_LIBRARIES}
+                                       ${GLUT_LIBRARY})
+
+    set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
+
+endif (OPENGL_FOUND AND GLUT_FOUND)
+
 configure_file( ${KS_DIR}/build/deff.h.cmake
                 ${KS_DIR}/src/KsDeff.h)
kernel-shark-qt/src/libkshark-plot.c new file +212 -0

212 lines not on this page · raw message

kernel-shark-qt/src/libkshark-plot.h new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
2.17.1
#3 lore raw

PATCH v3 3/4 kernel-shark-qt: Add C++ API for drawing of Graphs

In reply to Yordan Karadzhov (VMware)

This patch extends the KernelShark Plotting library, by adding a C++ API for drawing CPU and Task Graphs.

---
 kernel-shark-qt/src/CMakeLists.txt  |    3 +-
 kernel-shark-qt/src/KsPlotTools.cpp | 1123 +++++++++++++++++++++++++++
 kernel-shark-qt/src/KsPlotTools.hpp |  485 ++++++++++++
 3 files changed, 1610 insertions(+), 1 deletion(-)
 create mode 100644 kernel-shark-qt/src/KsPlotTools.cpp
 create mode 100644 kernel-shark-qt/src/KsPlotTools.hpp
kernel-shark-qt/src/CMakeLists.txt +2 -1
index 9c74bc0..ac2847a 100644
@@ -16,7 +16,8 @@ set_target_properties(kshark  PROPERTIES SUFFIX	".so.${KS_VERSION_STRING}")
 if (OPENGL_FOUND AND GLUT_FOUND)
 
     message(STATUS "libkshark-plot")
-    add_library(kshark-plot  SHARED  libkshark-plot.c)
+    add_library(kshark-plot  SHARED  libkshark-plot.c
+                                     KsPlotTools.cpp)
 
     target_link_libraries(kshark-plot  kshark
                                        ${OPENGL_LIBRARIES}
kernel-shark-qt/src/KsPlotTools.cpp new file +1123 -0

1,123 lines not on this page · raw message

kernel-shark-qt/src/KsPlotTools.hpp new file +485 -0

485 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

PATCH v3 4/4 kernel-shark-qt: Add an example showing how to draw shapes and Graphs.

In reply to Yordan Karadzhov (VMware)

This patch introduces a basic example, showing how to initialize OpenGL and how to use the C++ API in order to draw simple shapes or to show animated Graphs.

---
 kernel-shark-qt/examples/CMakeLists.txt |   4 +
 kernel-shark-qt/examples/dataplot.cpp   | 231 ++++++++++++++++++++++++
 2 files changed, 235 insertions(+)
 create mode 100644 kernel-shark-qt/examples/dataplot.cpp
kernel-shark-qt/examples/CMakeLists.txt +4 -0
index a3745fa..0c83293 100644
@@ -15,3 +15,7 @@ target_link_libraries(dhisto   kshark)
 message(STATUS "confogio")
 add_executable(confio          configio.c)
 target_link_libraries(confio   kshark)
+
+message(STATUS "dataplot")
+add_executable(dplot          dataplot.cpp)
+target_link_libraries(dplot   kshark-plot)
kernel-shark-qt/examples/dataplot.cpp new file +231 -0

231 lines not on this page · raw message

Signature · 1 line
2.17.1
#5 lore raw
In reply to Yordan Karadzhov (VMware)
Quoted 4 lines · On Tue, 28 Aug 2018 16:08:34 +0300 "Yordan Karadzhov (VMware)"…

The KernelShark plotting library is introduced in this series of patches. The library will be used by the GUI to draw CPU and Task Graphs. This is also the first time KernelShark enters the world of C++.

Quoted 8 lines

This is the 3th version of this series of patches. The major change from v2 is the debugging of the example ([PATCH 3/4]).

Yordan Karadzhov (VMware) (4):
kernel-shark-qt: Add OpenGL/GLUT as a third party dependency.
kernel-shark-qt: Add basic instruments for OpenGL plotting.
kernel-shark-qt: Add C++ API for drawing of Graphs
kernel-shark-qt: Add an example showing how to draw shapes and Graphs.

I pulled these and pushed them to my repo.

Thanks Yordan!

-- Steve

Quoted 17 lines
 kernel-shark-qt/CMakeLists.txt          |    3 +
 kernel-shark-qt/README                  |    2 +
 kernel-shark-qt/examples/CMakeLists.txt |    4 +
 kernel-shark-qt/examples/dataplot.cpp   |  231 +++++
 kernel-shark-qt/src/CMakeLists.txt      |   14 +
 kernel-shark-qt/src/KsPlotTools.cpp     | 1123 +++++++++++++++++++++++
 kernel-shark-qt/src/KsPlotTools.hpp     |  485 ++++++++++
 kernel-shark-qt/src/libkshark-plot.c    |  212 +++++
 kernel-shark-qt/src/libkshark-plot.h    |   69 ++
 9 files changed, 2143 insertions(+)
 create mode 100644 kernel-shark-qt/examples/dataplot.cpp
 create mode 100644 kernel-shark-qt/src/KsPlotTools.cpp
 create mode 100644 kernel-shark-qt/src/KsPlotTools.hpp
 create mode 100644 kernel-shark-qt/src/libkshark-plot.c
 create mode 100644 kernel-shark-qt/src/libkshark-plot.h