diff mbox series

[v2,15/23] kernel-shark-qt: Add kshark-record executable

Message ID 20181016155232.5257-16-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Headers show
Series Add Qt-based GUI for KernelShark | expand

Commit Message

Yordan Karadzhov Oct. 16, 2018, 3:53 p.m. UTC
From: Yordan Karadzhov (VMware) <y.karadz@gmail.com>

kshark-record provides a simple GUI (dialog) used to generate command line
arguments for trace-cmd and to record trace data.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark-qt/src/CMakeLists.txt    |  4 ++++
 kernel-shark-qt/src/kshark-record.cpp | 29 +++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 kernel-shark-qt/src/kshark-record.cpp
diff mbox series

Patch

diff --git a/kernel-shark-qt/src/CMakeLists.txt b/kernel-shark-qt/src/CMakeLists.txt
index 3c9e1bf..3b47ce1 100644
--- a/kernel-shark-qt/src/CMakeLists.txt
+++ b/kernel-shark-qt/src/CMakeLists.txt
@@ -69,6 +69,10 @@  if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
     add_executable(kernelshark          kernelshark.cpp)
     target_link_libraries(kernelshark   kshark-gui)
 
+    message(STATUS "kshark-record")
+    add_executable(kshark-record        kshark-record.cpp)
+    target_link_libraries(kshark-record kshark-gui)
+
 endif (Qt5Widgets_FOUND AND Qt5Network_FOUND)
 
 add_subdirectory(plugins)
diff --git a/kernel-shark-qt/src/kshark-record.cpp b/kernel-shark-qt/src/kshark-record.cpp
new file mode 100644
index 0000000..7d10469
--- /dev/null
+++ b/kernel-shark-qt/src/kshark-record.cpp
@@ -0,0 +1,29 @@ 
+// SPDX-License-Identifier: GPL-2.0
+
+/*
+ * Copyright (C) 2018 VMware Inc, Yordan Karadzhov <y.karadz@gmail.com>
+ */
+
+// C
+#include <unistd.h>
+
+// KernelShark
+#include "KsCaptureDialog.hpp"
+
+int main(int argc, char **argv)
+{
+	QApplication a(argc, argv);
+	KsCaptureDialog cd;
+
+	int c;
+	while ((c = getopt(argc, argv, "o:")) != -1) {
+		switch(c) {
+		case 'o':
+			cd.setOutputFileName(QString(optarg));
+			break;
+		}
+	}
+
+	cd.show();
+	return a.exec();
+}