#if defined(Q_OS_UNIX) && !defined(Q_OS_MACX)# include <unistd.h>#elif defined(Q_OS_MACX)# include <mach/mach.h># include <mach/machine.h>#endif/***************************************************************************** * * static functions used to init Class PDefaults * *****************************************************************************/static int getCpuCount(){ int cpuCount = 1;#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) { SYSTEM_INFO si; GetSystemInfo(&si); cpuCount = si.dwNumberOfProcessors; }#elif defined(Q_OS_UNIX) && !defined(Q_OS_MACX) cpuCount = sysconf(_SC_NPROCESSORS_ONLN);#elif defined(Q_OS_MACX) kern_return_t kr; struct host_basic_info hostinfo; unsigned int count; count = HOST_BASIC_INFO_COUNT; kr = host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hostinfo, &count); if(kr == KERN_SUCCESS) { cpuCount = hostinfo.avail_cpus;// totalMemory = hostinfo.memory_size; //in bytes }#endif if( cpuCount < 1 ) cpuCount = 1; return cpuCount;}