* Ask the operating system to pin the current thread to a given CPU. * * \param cpu * Indicates the desired CPU and hyperthread; low order 2 bits * specify CPU, next bit specifies hyperthread. */
| 61 | * specify CPU, next bit specifies hyperthread. |
| 62 | */ |
| 63 | void bindThreadToCpu(int cpu) |
| 64 | { |
| 65 | cpu_set_t set; |
| 66 | CPU_ZERO(&set); |
| 67 | CPU_SET(cpu, &set); |
| 68 | sched_setaffinity((pid_t)syscall(SYS_gettid), sizeof(set), &set); |
| 69 | } |
| 70 | |
| 71 | /* |
| 72 | * This function just discards its argument. It's used to make it |
no outgoing calls
no test coverage detected