linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org,
	"Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH 4/4] kernel-shark: Cleanup in KsCaptureDialog
Date: Fri, 20 Sep 2019 13:48:31 +0300	[thread overview]
Message-ID: <20190920104831.23475-5-y.karadz@gmail.com> (raw)
In-Reply-To: <20190920104831.23475-1-y.karadz@gmail.com>

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).

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/KsCaptureDialog.cpp | 21 +++++++++++----------
 kernel-shark/src/KsCaptureDialog.hpp |  2 --
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/kernel-shark/src/KsCaptureDialog.cpp b/kernel-shark/src/KsCaptureDialog.cpp
index fff42aa..ad05917 100644
--- a/kernel-shark/src/KsCaptureDialog.cpp
+++ b/kernel-shark/src/KsCaptureDialog.cpp
@@ -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()) {
diff --git a/kernel-shark/src/KsCaptureDialog.hpp b/kernel-shark/src/KsCaptureDialog.hpp
index 612080c..3fd3d8d 100644
--- a/kernel-shark/src/KsCaptureDialog.hpp
+++ b/kernel-shark/src/KsCaptureDialog.hpp
@@ -141,8 +141,6 @@ public:
 	 */
 	bool		_argsModified;
 
-	bool		_captureStatus;
-
 private:
 	QVBoxLayout	_layout;
 
-- 
2.20.1


      parent reply	other threads:[~2019-09-20 10:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20 10:48 [PATCH 0/4] Fixes needed for KS 1.1 Yordan Karadzhov (VMware)
2019-09-20 10:48 ` [PATCH 1/4] kernel-shark: Use correct order when linking all depenancies Yordan Karadzhov (VMware)
2019-09-20 10:48 ` [PATCH 2/4] trace-cmd: Correct the install paths of traceevent and trace-cmd libraries Yordan Karadzhov (VMware)
2019-09-20 12:00   ` Yordan Karadzhov (VMware)
2019-09-20 10:48 ` [PATCH 3/4] kernel-shark: Fix the file paths used by Doxygen Yordan Karadzhov (VMware)
2019-09-20 10:48 ` Yordan Karadzhov (VMware) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190920104831.23475-5-y.karadz@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).