+ delay();
+
+ return delayExtract;
+}
+
+void InitializationThread::runBenchmark(void)
+{
+#ifdef ENABLE_BENCHMARK
+ static const size_t nLoops = 5;
+ const size_t maxThreads = (5 * m_cpuFeatures.count);
+ QMap<size_t, double> results;
+
+ for(size_t c = 1; c <= maxThreads; c++)
+ {
+ double delayAcc = 0.0;
+ for(size_t i = 0; i < nLoops; i++)
+ {
+ delayAcc += doInit(c);
+ lamexp_clean_all_tools();
+ }
+ results.insert(c, (delayAcc / double(nLoops)));
+ }
+
+ qWarning("\n----------------------------------------------");
+ qWarning("Benchmark Results:");
+ qWarning("----------------------------------------------");
+
+ double bestTime = DBL_MAX; size_t bestVal = 0;
+ QList<size_t> keys = results.keys();
+ for(QList<size_t>::ConstIterator iter = keys.begin(); iter != keys.end(); iter++)
+ {
+ const double time = results.value((*iter), DBL_MAX);
+ qWarning("%02u -> %7.4f", (*iter), time);
+ if(time < bestTime)
+ {
+ bestTime = time;
+ bestVal = (*iter);
+ }
+ }
+
+ qWarning("----------------------------------------------");
+ qWarning("BEST: %u of %u (factor: %7.4f)", bestVal, m_cpuFeatures.count, (double(bestVal) / double(m_cpuFeatures.count)));
+ qWarning("----------------------------------------------\n");
+
+ qFatal("Benchmark complete. Thanks and bye bye!");
+#else //ENABLE_BENCHMARK
+ THROW("Sorry, the benchmark is *not* available in this build!");
+#endif //ENABLE_BENCHMARK