This patch defines two identical private methods for single-threaded and multi-threaded search inside the data table. This is done as a preparation for the following patch that will change the mechanism of the multi-threaded search. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx> --- kernel-shark/src/KsTraceViewer.cpp | 12 ++++++------ kernel-shark/src/KsTraceViewer.hpp | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/kernel-shark/src/KsTraceViewer.cpp b/kernel-shark/src/KsTraceViewer.cpp index c176cef..0694532 100644 --- a/kernel-shark/src/KsTraceViewer.cpp +++ b/kernel-shark/src/KsTraceViewer.cpp @@ -621,9 +621,9 @@ size_t KsTraceViewer::_searchItems() if (column == KsViewModel::TRACE_VIEW_COL_INFO || column == KsViewModel::TRACE_VIEW_COL_LAT) - _proxyModel.search(&_searchFSM, &_matchList); + _searchItemsST(); else - _searchItemsMapReduce(column, searchText, _searchFSM.condition()); + _searchItemsMT(); } count = _matchList.count(); @@ -673,9 +673,7 @@ void KsTraceViewer::_setSearchIterator(int row) } } -void KsTraceViewer::_searchItemsMapReduce(int column, - const QString &searchText, - search_condition_func cond) +void KsTraceViewer::_searchItemsMT() { int nThreads = std::thread::hardware_concurrency(); std::vector<QPair<int, int>> ranges(nThreads); @@ -685,7 +683,9 @@ void KsTraceViewer::_searchItemsMapReduce(int column, auto lamSearchMap = [&] (const QPair<int, int> &range, bool notify) { - return _proxyModel.searchMap(column, searchText, cond, + return _proxyModel.searchMap(_searchFSM._columnComboBox.currentIndex(), + _searchFSM._searchLineEdit.text(), + _searchFSM.condition(), range.first, range.second, notify); }; diff --git a/kernel-shark/src/KsTraceViewer.hpp b/kernel-shark/src/KsTraceViewer.hpp index cf529ba..6080d0d 100644 --- a/kernel-shark/src/KsTraceViewer.hpp +++ b/kernel-shark/src/KsTraceViewer.hpp @@ -132,8 +132,9 @@ private: size_t _searchItems(); - void _searchItemsMapReduce(int column, const QString &searchText, - search_condition_func cond); + void _searchItemsST() {_proxyModel.search(&_searchFSM, &_matchList);} + + void _searchItemsMT(); void _searchEditText(const QString &); -- 2.20.1