2013-10-26 21:19:49 +00:00
|
|
|
#include "System.h"
|
|
|
|
|
|
|
|
#include <QThread>
|
|
|
|
|
|
|
|
static int core_count = -1;
|
|
|
|
|
|
|
|
int System::getCoreCount()
|
|
|
|
{
|
|
|
|
if (core_count < 0)
|
|
|
|
{
|
2013-12-17 22:01:36 +00:00
|
|
|
#ifdef NDEBUG
|
2013-10-26 21:19:49 +00:00
|
|
|
core_count = QThread::idealThreadCount();
|
|
|
|
if (core_count <= 0)
|
|
|
|
{
|
2013-12-17 22:01:36 +00:00
|
|
|
qWarning("Can't find number of CPU cores, using only 1");
|
2013-10-26 21:19:49 +00:00
|
|
|
core_count = 1;
|
|
|
|
}
|
2013-12-17 22:01:36 +00:00
|
|
|
#else
|
|
|
|
core_count = 1;
|
|
|
|
#endif
|
2013-10-26 21:19:49 +00:00
|
|
|
}
|
|
|
|
return core_count;
|
|
|
|
}
|