| 44 | } |
| 45 | |
| 46 | AffinityMask getThreadAffinity() |
| 47 | { |
| 48 | AffinityMask mask; |
| 49 | |
| 50 | cpu_set_t cpuSet; |
| 51 | CPU_ZERO(&cpuSet); |
| 52 | if (pthread_getaffinity_np(pthread_self(), sizeof(cpuSet), &cpuSet) == 0) |
| 53 | { |
| 54 | int processorCount = getProcessorCount(); |
| 55 | int maskSize = (int) mask.size(); |
| 56 | for (int i = 0; i < processorCount && i < maskSize; ++i) |
| 57 | { |
| 58 | if (CPU_ISSET(i, &cpuSet)) |
| 59 | mask.set(i); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | return mask; |
| 64 | } |
| 65 | |
| 66 | uint32_t getCurrentThreadId() |
| 67 | { |
nothing calls this directly
no test coverage detected