AutoTest: Make scan thread limit customizable

Allow users to specify the tread limit used when scanning
for tests.
By default we continue to use a fourth of the available
logical CPUs.

Task-number: QTCREATORBUG-29301
Change-Id: Ic92a4d0908093c0664aa1ba924e0c17dfd0082f9
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Christian Stenger
2023-06-30 10:53:08 +02:00
parent 56772fbcc6
commit e38cd151cf
4 changed files with 16 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
#include "autotestconstants.h"
#include "autotesttr.h"
#include "testsettings.h"
#include "testtreemodel.h"
#include <coreplugin/editormanager/editormanager.h>
@@ -360,7 +361,11 @@ void TestCodeParser::scanForTests(const QSet<FilePath> &filePaths,
using namespace Tasking;
QList<GroupItem> tasks{parallelLimit(std::max(QThread::idealThreadCount() / 4, 1))};
int limit = TestSettings::instance()->scanThreadLimit();
if (limit == 0)
limit = std::max(QThread::idealThreadCount() / 4, 1);
qCDebug(LOG) << "Using" << limit << "threads for scan.";
QList<GroupItem> tasks{parallelLimit(limit)};
for (const FilePath &file : filteredFiles) {
const auto setup = [this, codeParsers, file](Async<TestParseResultPtr> &async) {
async.setConcurrentCallData(parseFileForTests, codeParsers, file);