Slightly tweak algorithm to automatically set the number of instances: Instead of restricting the number of instances to 4, we now use '(cpu_cores / 2) + 2' instances for more than 4 CPU cores. For at most 4 CPU cores, we still use 'cpu_cores' instances. This way we can use more than 4 instances on CPU's with more than 4 cores, but the number of instances won't grow linearly with the number of CPU cores - should help a bit to avoid HDD thrashing.
This commit is contained in:
parent
61e5ab9f6a
commit
a2cae5c288
@ -68,9 +68,6 @@
|
||||
//Maximum number of parallel instances
|
||||
#define MAX_INSTANCES 16U
|
||||
|
||||
//Maximum number of CPU cores for auto-detection
|
||||
#define MAX_CPU_COUNT 4U
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#define CHANGE_BACKGROUND_COLOR(WIDGET, COLOR) \
|
||||
@ -126,6 +123,8 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
|
||||
|
||||
//Init progress indicator
|
||||
m_progressIndicator = new QMovie(":/images/Working.gif");
|
||||
m_progressIndicator->setCacheMode(QMovie::CacheAll);
|
||||
m_progressIndicator->setSpeed(50);
|
||||
label_headerWorking->setMovie(m_progressIndicator);
|
||||
progressBar->setValue(0);
|
||||
|
||||
@ -361,7 +360,7 @@ void ProcessingDialog::initEncoding(void)
|
||||
if(maximumInstances < 1)
|
||||
{
|
||||
lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features();
|
||||
maximumInstances = qBound(1U, static_cast<unsigned int>(cpuFeatures.count), MAX_CPU_COUNT);
|
||||
maximumInstances = (cpuFeatures.count > 4) ? ((cpuFeatures.count / 2) + 2) : cpuFeatures.count;
|
||||
}
|
||||
|
||||
unsigned int parallelThreadCount = qBound(1U, maximumInstances, static_cast<unsigned int>(m_pendingJobs.count()));
|
||||
@ -965,4 +964,4 @@ bool ProcessingDialog::shutdownComputer(void)
|
||||
|
||||
progressDialog.close();
|
||||
return true;
|
||||
}
|
||||
}
|
@ -616,7 +616,7 @@ lamexp_cpu_t lamexp_detect_cpu_features(int argc, char **argv)
|
||||
{
|
||||
GetSystemInfo(&systemInfo);
|
||||
}
|
||||
features.count = systemInfo.dwNumberOfProcessors;
|
||||
features.count = qBound(1UL, systemInfo.dwNumberOfProcessors, 64UL);
|
||||
#else
|
||||
GetNativeSystemInfo(&systemInfo);
|
||||
features.count = systemInfo.dwNumberOfProcessors;
|
||||
|
Loading…
Reference in New Issue
Block a user