kernel-shark: Cleanup in KsCaptureDialog
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).
Link: http://lore.kernel.org/linux-trace-devel/20190920104831.23475-5-y.karadz@gmail.com
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
diff --git a/kernel-shark/src/KsCaptureDialog.cpp b/kernel-shark/src/KsCaptureDialog.cpp
index dc1e9b2..a284ea0 100644
--- a/kernel-shark/src/KsCaptureDialog.cpp
+++ b/kernel-shark/src/KsCaptureDialog.cpp
@@ -358,7 +358,6 @@
: QWidget(parent),
_mergedChannels(false),
_argsModified(false),
- _captureStatus(false),
_panel(this),
_name("Output display", this),
_space("max size ", this),
@@ -496,9 +495,6 @@
_consolOutput.appendPlainText(errMessage);
QCoreApplication::processEvents();
- _captureStatus = false;
- } else {
- _captureStatus = true;
}
}
@@ -558,6 +554,17 @@
_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") {
@@ -565,9 +572,6 @@
break;
}
}
-
- /* Reset the _argsModified flag. */
- _captureMon._argsModified = false;
}
void KsCaptureDialog::_setChannelMode(int state)
@@ -583,9 +587,6 @@
{
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 f8ddf4a..c914d7a 100644
--- a/kernel-shark/src/KsCaptureDialog.hpp
+++ b/kernel-shark/src/KsCaptureDialog.hpp
@@ -125,8 +125,6 @@
*/
bool _argsModified;
- bool _captureStatus;
-
private:
QVBoxLayout _layout;