linyinma
2018-07-11 17:32:03 +08:00
CPU 亲和性设置
/* API */
/* Set the CPU affinity for a task */
int sched_setaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
/* Get the CPU affinity for a task */
int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
/* set CPU affinity attribute in thread attributes object */
int pthread_attr_setaffinity_np(pthread_attr_t *attr, size_t cpusetsize, const cpu_set_t *cpuset);
/* get CPU affinity attribute in thread attributes object */
int pthread_attr_getaffinity_np(const pthread_attr_t *attr, size_t cpusetsize, cpu_set_t *cpuset);
/* set CPU affinity of a thread */
int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize, const cpu_set_t *cpuset);
/* get CPU affinity of a thread */
int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize, cpu_set_t *cpuset);