[질문 하나 기록] android ndk에서 라인을 설정하는 친연성은 두 개의 핵이 설정하지 못합니다.

1220 단어
이 기사를 참조하십시오.https://blog.csdn.net/lanyzh0909/article/details/50404664대략적인 코드는 다음과 같습니다.
#include 
#include 

#include 
#include 
#include 
#include 
#include 

void* _thread_func(void* param){
    int thread_index = *(int*)param;
    int cpu_count = sysconf(_SC_NPROCESSORS_CONF);
    cpu_set_t mask;                // CPU    
    cpu_set_t get;                 //       CPU
    CPU_ZERO(&mask);               //  
    CPU_SET(thread_index, &mask);  //      
    //    CPU   
    if (sched_setaffinity(0, sizeof(mask), &mask) == -1) {
      printf("warning: could not set CPU %d affinity, continuing...
", thread_index); } else { printf("thread %d set to cpu %d
", thread_index, thread_index); } }

퀄컴 스냅드래곤 835 프로세서에서 Warning: could not set CPU 7 affinity,continuing...thread 1 set to cpu 1 thread 0 set to cpu 0 thread 3 set to cpu 3 thread 2 set to cpu 2 warning: could not set CPU 4 affinity, continuing... thread 5 set to cpu 5 thread 6 set to cpu 6
시스템이 고의로 두 핵을 친연성으로 설정하지 못하게 한 것으로 추정되는데 원인은 알 수 없다.

좋은 웹페이지 즐겨찾기