1

As mentioned in the title, I'm looking for a way to get the number of cores of an android device, but without the hyperthreated cores that count as two.

I found that function to get the number of cores:

Runtime.getRuntime().availableProcessors()

But a comment here How to get the number of cores of an android device points at that it will count hyperthreated cores double.

So how to avoid that?

Update

I tried to get it with (thanks to this website: https://myshell.co.uk/blog/2012/07/how-to-determine-the-number-of-physical-cpus-on-linux/)

cat /proc/cpuinfo | grep "cpu cores" | uniq

It works with Emulator, but not with a real device. That is the cpuinfo:

Processor   : ARMv7 Processor rev 3 (v7l)
processor   : 0
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 33.76
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xc07
CPU revision    : 3

Hardware    : MT6580M
Revision    : 0000
Serial      : 0000000000000000

So there is no line including 'cpu cores'. Is there any other way to get it?

  • I think you need to run some linux command for that. I don't think that ANdroid SDK provides such info – Vladyslav Matviienko Jun 22 '18 at 08:48
  • https://myshell.co.uk/blog/2012/07/how-to-determine-the-number-of-physical-cpus-on-linux/ that works, just have to use that in java, but that is easy –  Jun 22 '18 at 10:21
  • That does not work, because there is no information in proc/cpuinfo. Is there any other way? Will update the question. –  Jun 22 '18 at 16:41
  • Could it be that there is now hyperthreading for smartphones and the little and big cores cause the "error" in the comment mentioned above? –  Jun 23 '18 at 09:05

0 Answers0