From patchwork Wed Nov 21 15:14:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10759841 Return-Path: Received: from mail-eopbgr790077.outbound.protection.outlook.com ([40.107.79.77]:22848 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731144AbeKVBtv (ORCPT ); Wed, 21 Nov 2018 20:49:51 -0500 From: Yordan Karadzhov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH 07/11] kernel-shark-qt: Optimize the search in a case of a small data-set Date: Wed, 21 Nov 2018 15:14:25 +0000 Message-ID: <20181121151356.16901-9-ykaradzhov@vmware.com> References: <20181121151356.16901-1-ykaradzhov@vmware.com> In-Reply-To: <20181121151356.16901-1-ykaradzhov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1646 Parallelizing the search (map-reduce) and showing the progress make sense only in the case of very big data-sets. If the data-set is small we do not want to have the overhead added by the update of the progress bar. This overhead turns to be not so small (~1s. on my laptop). Signed-off-by: Yordan Karadzhov --- kernel-shark-qt/src/KsTraceViewer.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/kernel-shark-qt/src/KsTraceViewer.cpp b/kernel-shark-qt/src/KsTraceViewer.cpp index 1f96234..64c9fb7 100644 --- a/kernel-shark-qt/src/KsTraceViewer.cpp +++ b/kernel-shark-qt/src/KsTraceViewer.cpp @@ -579,6 +579,12 @@ void KsTraceViewer::_resizeToContents() _view.setColumnWidth(0, columnSize); } +//! @cond Doxygen_Suppress + +#define KS_SEARCH_SHOW_PROGRESS_MIN 100000 + +//! @endcond + size_t KsTraceViewer::_searchItems(int column, const QString &searchText, condition_func cond) @@ -588,7 +594,14 @@ size_t KsTraceViewer::_searchItems(int column, _searchProgBar.show(); _pbAction->setVisible(true); - if (column == KsViewModel::TRACE_VIEW_COL_INFO || + if (_proxyModel.rowCount({}) < KS_SEARCH_SHOW_PROGRESS_MIN) { + /* + * This is a small data-set. Do a single-threaded search + * without showing the progress. + */ + _proxyModel.search(column, searchText, cond, &_matchList, + nullptr, nullptr); + } else if (column == KsViewModel::TRACE_VIEW_COL_INFO || column == KsViewModel::TRACE_VIEW_COL_LAT) { _searchStopAction->setVisible(true); _proxyModel.search(column, searchText, cond, &_matchList,