Skip to content

Commit 0b7cd65

Browse files
author
stgatilov
committed
#6503. Added cvar to force number of threads in noninteractive joblists.
Also renamed the other cvars. git-svn-id: http://svn.thedarkmod.com/svn/darkmod_src/trunk@10686 49c82d7f-2e2a-0410-a16f-ae8f201b507f
1 parent 4561830 commit 0b7cd65

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Diff for: idlib/ParallelJobList.cpp

+16-8
Original file line numberDiff line numberDiff line change
@@ -1102,17 +1102,22 @@ extern void Sys_CPUCount( int & logicalNum, int & coreNum, int & packageNum );
11021102
CORE_ANY, CORE_ANY, CORE_ANY, CORE_ANY }
11031103

11041104

1105-
idCVar jobs_numThreads(
1106-
"jobs_numThreads", "-1", CVAR_INTEGER | CVAR_NOCHEAT | CVAR_ARCHIVE,
1105+
idCVar jobs_numThreadsRealtime(
1106+
"jobs_numThreadsRealtime", "-1", CVAR_INTEGER | CVAR_NOCHEAT | CVAR_ARCHIVE,
11071107
"Number of threads used by job system during gameplay (REALTIME joblists). "
11081108
"-1 means it is determined automatically.",
11091109
-1, MAX_JOB_THREADS );
1110-
idCVar jobs_numThreadsOffset(
1111-
"jobs_numThreadsOffset", "0", CVAR_INTEGER | CVAR_NOCHEAT | CVAR_ARCHIVE,
1110+
idCVar jobs_offsetThreadsRealtime(
1111+
"jobs_offsetThreadsRealtime", "0", CVAR_INTEGER | CVAR_NOCHEAT | CVAR_ARCHIVE,
11121112
"Added to automatically computed number of threads for jobs system during gameplay. "
1113-
"Only takes effect if jobs_numThreads is set to auto. "
1113+
"Only takes effect if jobs_numThreadsRealtime is set to auto. "
11141114
"For instance: set -1 if you want to leave one free thread for graphics driver.",
11151115
-MAX_JOB_THREADS, MAX_JOB_THREADS );
1116+
idCVar jobs_numThreadsNonInteractive(
1117+
"jobs_numThreadsNonInteractive", "-1", CVAR_INTEGER | CVAR_NOCHEAT | CVAR_ARCHIVE,
1118+
"Number of threads used by job system for non-interactive tasks (NONINTERACTIVE joblists). "
1119+
"-1 means it is determined automatically.",
1120+
-1, MAX_JOB_THREADS );
11161121
idCVar jobs_maxHddThreads(
11171122
"jobs_maxHddThreads", "1", CVAR_INTEGER | CVAR_NOCHEAT | CVAR_ARCHIVE,
11181123
"Maximum number of threads used for jobs that read from disk if game is on Hard Disk Drive. "
@@ -1323,13 +1328,16 @@ void idParallelJobManagerLocal::Submit( idParallelJobList_Threads * jobList, int
13231328
// we assume that calling thread will wait immediately and free its core for one of the worker threads
13241329
numThreads = numPhysicalCpuCores - dedicatedOccupiedThreads + 1;
13251330
// leave a few cores for OS background tasks, and maybe for OpenGL driver since they often do work in separate thread
1326-
numThreads += jobs_numThreadsOffset.GetInteger();
1331+
numThreads += jobs_offsetThreadsRealtime.GetInteger();
13271332

1328-
if ( jobs_numThreads.GetInteger() >= 0 )
1329-
numThreads = jobs_numThreads.GetInteger();
1333+
if ( jobs_numThreadsRealtime.GetInteger() >= 0 )
1334+
numThreads = jobs_numThreadsRealtime.GetInteger();
13301335
}
13311336
else if ( parallelism == JOBLIST_PARALLELISM_NONINTERACTIVE ) {
13321337
numThreads = numLogicalCpuCores;
1338+
1339+
if ( jobs_numThreadsNonInteractive.GetInteger() >= 0 )
1340+
numThreads = jobs_numThreadsNonInteractive.GetInteger();
13331341
}
13341342
else if ( parallelism == JOBLIST_PARALLELISM_NONE ) {
13351343
numThreads = 0;

0 commit comments

Comments
 (0)