add option to bruteforce test to force count of worker threads (#2188)

- to be able to have deterministic results it is useful to have a
mechanism
  to force the same count of workers
- this commit doesn't change the default settings but expands
  functionality

Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>

Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
Katarzyna Cencelewska
2024-12-17 18:58:03 +01:00
committed by GitHub
parent 57a91b7ffe
commit e17e6eef7b

View File

@@ -379,6 +379,7 @@ static int ParseArgs(int argc, const char **argv)
gTestNames.push_back("");
int singleThreaded = 0;
int forcedWorkerThreads = 0;
{ // Extract the app name
strncpy(appName, argv[0], MAXPATHLEN - 1);
@@ -430,6 +431,11 @@ static int ParseArgs(int argc, const char **argv)
case 'm': singleThreaded ^= 1; break;
case 't':
forcedWorkerThreads = atoi(argv[++i]);
vlog(" %d", forcedWorkerThreads);
break;
case 'g': gHasHalf ^= 1; break;
case 'r': gTestFastRelaxed ^= 1; break;
@@ -540,7 +546,17 @@ static int ParseArgs(int argc, const char **argv)
gWimpyReductionFactor);
}
if (singleThreaded) SetThreadCount(1);
if (singleThreaded)
{
vlog("*** WARNING: Force 1 worker thread ***\n");
SetThreadCount(1);
}
else if (forcedWorkerThreads > 0)
{
vlog("*** WARNING: Force %d worker threads ***\n",
forcedWorkerThreads);
SetThreadCount(forcedWorkerThreads);
}
return 0;
}