mirror of https://github.com/opencv/opencv.git
- make it configurable via OPENCV_TBB_RELEASE + OPENCV_TBB_RELEASE_MD5 - remove legacy supportpull/14926/head
parent
bc79f477dd
commit
43e457c883
3 changed files with 17 additions and 75 deletions
@ -1,41 +0,0 @@ |
||||
#include <cstdio> |
||||
|
||||
static inline int getPossibleCPUs() |
||||
{ |
||||
FILE* cpuPossible = fopen("/sys/devices/system/cpu/possible", "r"); |
||||
if(!cpuPossible) |
||||
return 1; |
||||
|
||||
char buf[2000]; //big enough for 1000 CPUs in worst possible configuration
|
||||
char* pbuf = fgets(buf, sizeof(buf), cpuPossible); |
||||
fclose(cpuPossible); |
||||
if(!pbuf) |
||||
return 1; |
||||
|
||||
//parse string of form "0-1,3,5-7,10,13-15"
|
||||
int cpusAvailable = 0; |
||||
|
||||
while(*pbuf) |
||||
{ |
||||
const char* pos = pbuf; |
||||
bool range = false; |
||||
while(*pbuf && *pbuf != ',') |
||||
{ |
||||
if(*pbuf == '-') range = true; |
||||
++pbuf; |
||||
} |
||||
if(*pbuf) *pbuf++ = 0; |
||||
if(!range) |
||||
++cpusAvailable; |
||||
else |
||||
{ |
||||
int rstart = 0, rend = 0; |
||||
sscanf(pos, "%d-%d", &rstart, &rend); |
||||
cpusAvailable += rend - rstart + 1; |
||||
} |
||||
|
||||
} |
||||
return cpusAvailable ? cpusAvailable : 1; |
||||
} |
||||
|
||||
#define __TBB_HardwareConcurrency() getPossibleCPUs() |
@ -1,11 +0,0 @@ |
||||
#include "tbb/tbb_misc.h" |
||||
|
||||
namespace tbb { |
||||
namespace internal { |
||||
|
||||
void affinity_helper::protect_affinity_mask(bool) {} |
||||
affinity_helper::~affinity_helper() {} |
||||
void destroy_process_mask() {} |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue