linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yordan Karadzhov <ykaradzhov@vmware.com>
To: "rostedt@goodmis.org" <rostedt@goodmis.org>
Cc: "linux-trace-devel@vger.kernel.org" <linux-trace-devel@vger.kernel.org>
Subject: [PATCH v2 3/8] kernel-shark-qt: Make the parallelized search stoppable
Date: Fri, 14 Dec 2018 12:52:37 +0000	[thread overview]
Message-ID: <20181214125212.9637-4-ykaradzhov@vmware.com> (raw)
In-Reply-To: <20181214125212.9637-1-ykaradzhov@vmware.com>

So far only the single-threaded search inside the "Latency" and "Info"
columns can be stopped by the "stop search" button. This patch makes it
possible to stop also the parallelized search. Note that after stopping
the parallelized search, the list of matches will contain entries which
may not be consecutive, because each thread was searching in its own
subset of the data and was stoped at an arbitrary position in this
subset.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/KsModels.cpp      |  6 +++++-
 kernel-shark-qt/src/KsModels.hpp      |  5 ++++-
 kernel-shark-qt/src/KsTraceViewer.cpp | 19 ++++++++++++-------
 3 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/kernel-shark-qt/src/KsModels.cpp b/kernel-shark-qt/src/KsModels.cpp
index d67ee62..c8cc410 100644
--- a/kernel-shark-qt/src/KsModels.cpp
+++ b/kernel-shark-qt/src/KsModels.cpp
@@ -80,7 +80,11 @@ void KsFilterProxyModel::_search(int column,
 			matchList->append(row);
 
 		if (_searchStop) {
-			_searchStop = false;
+			if (notify) {
+				_searchProgress = KS_PROGRESS_BAR_MAX;
+				_pbCond.notify_one();
+			}
+
 			break;
 		}
 
diff --git a/kernel-shark-qt/src/KsModels.hpp b/kernel-shark-qt/src/KsModels.hpp
index b66c259..08019e7 100644
--- a/kernel-shark-qt/src/KsModels.hpp
+++ b/kernel-shark-qt/src/KsModels.hpp
@@ -178,7 +178,10 @@ public:
 	int searchProgress() const {return _searchProgress;}
 
 	/** Reset the progress value of the search. */
-	void searchReset() {_searchProgress = 0;}
+	void searchReset() {
+		_searchProgress = 0;
+		_searchStop = false;
+	}
 
 	/** Stop the serch for all threads. */
 	void searchStop() {_searchStop = true;}
diff --git a/kernel-shark-qt/src/KsTraceViewer.cpp b/kernel-shark-qt/src/KsTraceViewer.cpp
index 7f0f1e2..aeed5f7 100644
--- a/kernel-shark-qt/src/KsTraceViewer.cpp
+++ b/kernel-shark-qt/src/KsTraceViewer.cpp
@@ -446,6 +446,7 @@ void KsTraceViewer::_searchStop()
 {
 	_searchStopAction->setVisible(false);
 	_proxyModel.searchStop();
+	_lockSearchPanel(false);
 }
 
 void KsTraceViewer::_clicked(const QModelIndex& i)
@@ -625,7 +626,6 @@ size_t KsTraceViewer::_searchItems(int column,
 {
 	int count, dataRow;
 
-	_searchProgBar.show();
 	_pbAction->setVisible(true);
 
 	if (_proxyModel.rowCount({}) < KS_SEARCH_SHOW_PROGRESS_MIN) {
@@ -635,15 +635,20 @@ size_t KsTraceViewer::_searchItems(int column,
 		 */
 		_proxyModel.search(column, searchText, cond, &_matchList,
 				   nullptr, nullptr);
-	} else if (column == KsViewModel::TRACE_VIEW_COL_INFO ||
-	    column == KsViewModel::TRACE_VIEW_COL_LAT) {
+	} else {
 		_searchStopAction->setVisible(true);
-		_proxyModel.search(column, searchText, cond, &_matchList,
-				   &_searchProgBar, &_searchCountLabel);
+
+		if (column == KsViewModel::TRACE_VIEW_COL_INFO ||
+		    column == KsViewModel::TRACE_VIEW_COL_LAT) {
+			_proxyModel.search(column, searchText,
+					   cond, &_matchList,
+					   &_searchProgBar,
+					   &_searchCountLabel);
+		} else {
+			_searchItemsMapReduce(column, searchText, cond);
+		}
 
 		_searchStopAction->setVisible(false);
-	} else {
-		_searchItemsMapReduce(column, searchText, cond);
 	}
 
 	count = _matchList.count();
-- 
2.17.1

  parent reply	other threads:[~2018-12-14 12:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14 12:52 [PATCH v2 0/8] More modifications toward KS 1.0 Yordan Karadzhov
2018-12-14 12:52 ` [PATCH v2 1/8] kernel-shark-qt: Lock completely the searching panel when searching Yordan Karadzhov
2018-12-14 14:50   ` Steven Rostedt
2018-12-14 14:52     ` Steven Rostedt
2018-12-14 12:52 ` [PATCH v2 2/8] kernel-shark-qt: Fix a simple bug in KsTraceViewer::_searchReset() Yordan Karadzhov
2018-12-14 12:52 ` Yordan Karadzhov [this message]
2018-12-14 17:17   ` [PATCH v2 3/8] kernel-shark-qt: Make the parallelized search stoppable Steven Rostedt
2018-12-17 17:02     ` Yordan Karadzhov (VMware)
2018-12-14 12:52 ` [PATCH v2 4/8] kernel-shark-qt: Avoid spurious searches Yordan Karadzhov
2018-12-14 12:52 ` [PATCH v2 5/8] kernel-shark-qt: Create "Apply filter XX" checkboxes in KsUtils Yordan Karadzhov
2018-12-14 17:01   ` Steven Rostedt
2018-12-17 17:44     ` Yordan Karadzhov (VMware)
2018-12-14 12:52 ` [PATCH v2 6/8] kernel-shark-qt: Improve the KsQuickContextMenu Yordan Karadzhov
2018-12-14 12:52 ` [PATCH v2 7/8] kernel-shark-qt: Update the documentation link Yordan Karadzhov
2018-12-14 12:52 ` [PATCH v2 8/8] kernel-shark-qt: Version 1.0.0 Yordan Karadzhov
2018-12-14 17:10 ` [PATCH v2 0/8] More modifications toward KS 1.0 Steven Rostedt
2018-12-17 17:11   ` Yordan Karadzhov (VMware)

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=20181214125212.9637-4-ykaradzhov@vmware.com \
    --to=ykaradzhov@vmware.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).