开发者

How to get the processor number on android

开发者 https://www.devze.com 2023-04-09 21:42 出处:网络
Hi all, I want to get the processor number on android. can I do that like as follow: int processporNum =sysconf(_SC_NPROCESSORS_CONF);

Hi all, I want to get the processor number on android. can I do that like as follow:

int processporNum =  sysconf(_SC_NPROCESSORS_CONF);

but everyt开发者_StackOverflow中文版ime the return value is 1 on some of my phones, so i not sure this methold is right .is there anyother api can get this info


you can run

Runtime.getRuntime().availableProcessors()


I see you're using native code.

So read file /proc/cpuinfo and interpret is accordingly. It looks something like this:

Processor   : ARMv7 Processor rev 2 (v7l)
BogoMIPS    : 162.83
Features    : swp half thumb fastmult vfp edsp thumbee neon 
CPU implementer : 0x51
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0x00f
CPU revision    : 2
Hardware    : htcleo
Revision    : 0000
Serial      : 0000000000000000 
0

精彩评论

暂无评论...
验证码 换一张
取 消