OSDN Git Service

Slightly tweak algorithm to automatically set the number of instances: Instead of...
authorlordmulder <mulder2@gmx.de>
Wed, 16 Nov 2011 21:53:18 +0000 (22:53 +0100)
committerlordmulder <mulder2@gmx.de>
Wed, 16 Nov 2011 21:53:18 +0000 (22:53 +0100)
src/Dialog_Processing.cpp
src/Global.cpp

index b6482c6..326b33a 100644 (file)
@@ -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;
-}
+}
\ No newline at end of file
index 521ef7b..050eff4 100644 (file)
@@ -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;