How to get the number of cores of an android device

后端 未结 8 2098
挽巷
挽巷 2020-12-04 21:44

I was looking to determine(or count) the number of cores in the embedded processor of android device.

I tried using /proc/cpuinfo, but it is not return

8条回答
  •  离开以前
    2020-12-04 22:32

    Try this:

    Runtime.getRuntime().availableProcessors();
    

    This returns the number of CPU's available for THIS specific virtual machine, as I experienced. That may not be what you want, still, for a few purposes this is very handy. You can test this really easily: Kill all apps, run the above code. Open 10 very intensive apps, and then run the test again. Sure, this will only work on a multi cpu device, I guess.

提交回复
热议问题