標籤:cpu affinity ati 線程 android c 擷取 log 無法 after
暫時無法擷取當前線程運行在哪個CPU上,待調查...
int omask = 0;int nmask = 0xF0;static void affinity() { int err; int syscallres = syscall(__NR_sched_getaffinity, gettid(), sizeof(omask), &omask); if (syscallres) { err = errno; LOGE("Error in the syscall getaffinity: omask=%d=0x%x err=%d=0x%x", omask, omask, err, err); } LOGE("before-get affinity success, tid = %d , mask = ", gettid(), omask); syscallres = syscall(__NR_sched_setaffinity, gettid(), sizeof(nmask), &nmask); if (syscallres) { err = errno; LOGE("Error in the syscall setaffinity: nmask=%d=0x%x err=%d=0x%x", nmask, nmask, err, err); } syscallres = syscall(__NR_sched_getaffinity, gettid(), sizeof(omask), &omask); if (syscallres) { err = errno; LOGE("Error in the syscall getaffinity: omask=%d=0x%x err=%d=0x%x", omask, omask, err, err); } LOGE("after-get affinity success, tid = %d , mask = ", gettid(), omask);}
android cpu affinity