android cpu affinity
Posted 吹
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了android cpu affinity相关的知识,希望对你有一定的参考价值。
暂时无法获取当前线程运行在哪个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的主要内容,如果未能解决你的问题,请参考以下文章
nginx优化CPU配置worker_cpu_affinity