MCPcopy Create free account
hub / github.com/Kitware/CMake / SetParallelLevel

Method SetParallelLevel

Source/CTest/cmCTestMultiProcessHandler.cxx:155–180  ·  view source on GitHub ↗

Set the max number of tests that can be run at the same time.

Source from the content-addressed store, hash-verified

153
154// Set the max number of tests that can be run at the same time.
155void cmCTestMultiProcessHandler::SetParallelLevel(cm::optional<size_t> level)
156{
157 this->ParallelLevel = level;
158
159 if (!this->ParallelLevel) {
160 // '-j' was given with no value. Limit by number of processors.
161 cmsys::SystemInformation info;
162 info.RunCPUCheck();
163 unsigned long processorCount = info.GetNumberOfLogicalCPU();
164
165 if (cm::optional<std::string> fakeProcessorCount =
166 cmSystemTools::GetEnvVar(
167 "__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING")) {
168 unsigned long pc = 0;
169 if (cmStrToULong(*fakeProcessorCount, &pc)) {
170 processorCount = pc;
171 } else {
172 cmSystemTools::Error("Failed to parse fake processor count: " +
173 *fakeProcessorCount);
174 }
175 }
176
177 this->ParallelLevelDefault =
178 std::max(kParallelLevelMinimum, processorCount);
179 }
180}
181
182size_t cmCTestMultiProcessHandler::GetParallelLevel() const
183{

Callers 2

ProcessOptionsMethod · 0.45
ProcessDirectoryMethod · 0.45

Calls 4

cmStrToULongFunction · 0.85
RunCPUCheckMethod · 0.80
GetNumberOfLogicalCPUMethod · 0.80
ErrorClass · 0.50

Tested by

no test coverage detected