Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the processor number on android

Tags:

android

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 everytime 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

like image 455
Samuel Avatar asked Sep 29 '11 07:09

Samuel


People also ask

How do I find my Android processor?

Settings -> About Phone should tell you most of what you want to know. Failing that, it will at least tell you a model name which you can then search google for more info. My 'About Phone' lists Model, CPU info (i.e. what CPU) and Memory info among other things.

How do I know my processor number?

Press Ctrl + Shift + Esc to open Task Manager. Select the Performance tab to see how many cores and logical processors your PC has.


2 Answers

you can run

Runtime.getRuntime().availableProcessors()
like image 150
Blackbelt Avatar answered Oct 04 '22 03:10

Blackbelt


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 
like image 34
Pointer Null Avatar answered Oct 04 '22 03:10

Pointer Null