diff mbox series

[3/8] kernel-shark: Optimize the command line options used by the capture dialog

Message ID 20190709155650.2345-4-y.karadz@gmail.com (mailing list archive)
State Accepted
Headers show
Series Fixes needed befor KS 1.0 | expand

Commit Message

Yordan Karadzhov July 9, 2019, 3:56 p.m. UTC
Do not include all events belonging to a given system if the whole system
is selected. Add only the name of the system instead. Do not specify a
plugin if the selected plugin is "nop".

Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/KsCaptureDialog.cpp | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/kernel-shark/src/KsCaptureDialog.cpp b/kernel-shark/src/KsCaptureDialog.cpp
index b107595..7da6c08 100644
--- a/kernel-shark/src/KsCaptureDialog.cpp
+++ b/kernel-shark/src/KsCaptureDialog.cpp
@@ -143,23 +143,14 @@  QStringList KsCaptureControl::getArgs()
 	QStringList argv;
 
 	argv << "record";
-	argv << "-p" << _pluginsComboBox.currentText();
 
-	if (_eventsWidget.all()) {
-		argv << "-e" << "all";
-	} else {
-		QVector<int> evtIds = _eventsWidget.getCheckedIds();
-		tep_event *event;
+	if (_pluginsComboBox.currentText() != "nop")
+		argv << "-p" << _pluginsComboBox.currentText();
 
-		for (auto const &id: evtIds) {
-			event = tep_find_event(_localTEP, id);
-			if (!event)
-				continue;
-
-			argv << "-e" + QString(event->system) +
-				":" + QString(event->name);
-		}
-	}
+	if (_eventsWidget.all())
+		argv << "-e" << "all";
+	else
+		argv << _eventsWidget.getCheckedEvents(true);
 
 	argv << "-o" << outputFileName();
 	argv << _commandLineEdit.text().split(" ");