666 |
info->num_threads = 0; |
info->num_threads = 0; |
667 |
|
|
668 |
#if defined(_WIN32) |
#if defined(_WIN32) |
669 |
|
|
670 |
{ |
{ |
|
DWORD dwProcessAffinityMask, dwSystemAffinityMask; |
|
|
if (GetProcessAffinityMask(GetCurrentProcess(), (PDWORD_PTR) &dwProcessAffinityMask, (PDWORD_PTR) &dwSystemAffinityMask)) { |
|
|
int i; |
|
|
for(i=0; i<32; i++) { |
|
|
if ((dwProcessAffinityMask & (1<<i))) |
|
|
info->num_threads++; |
|
|
} |
|
|
if (info->num_threads == 0) { |
|
671 |
SYSTEM_INFO siSysInfo; |
SYSTEM_INFO siSysInfo; |
672 |
GetSystemInfo(&siSysInfo); |
GetSystemInfo(&siSysInfo); |
673 |
info->num_threads = siSysInfo.dwNumberOfProcessors; /* number of _logical_ cores */ |
info->num_threads = siSysInfo.dwNumberOfProcessors; /* number of _logical_ cores */ |
674 |
} |
} |
675 |
} |
|
|
} |
|
676 |
#else |
#else |
677 |
|
|
678 |
#include <unistd.h> |
#include <unistd.h> |