android获取手机cpu是单核还是多核的方法
2013-02-21 15:27
429 查看
/** * Gets the number of cores available in this device, across all processors. * Requires: Ability to peruse the filesystem at "/sys/devices/system/cpu" * @return The number of cores, or 1 if failed to get result */ private int getNumCores() { //Private Class to display only CPU devices in the directory listing class CpuFilter implements FileFilter { @Override public boolean accept(File pathname) { //Check if filename is "cpu", followed by a single digit number if(Pattern.matches("cpu[0-9]", pathname.getName())) { return true; } return false; } } try { //Get directory containing CPU info File dir = new File("/sys/devices/system/cpu/"); //Filter to only list the devices we care about File[] files = dir.listFiles(new CpuFilter()); //Return the number of cores (virtual CPU devices) return files.length; } catch(Exception e) { //Default to return 1 core return 1; } }
参考http://stackoverflow.com/questions/7962155/how-can-you-detect-a-dual-core-cpu-on-an-android-device-from-code
相关文章推荐
- Android2.0中获取手机里联系人的方法
- android 获取手机中所有的传感器Sensor类使用方法
- 【小功能2】android获取手机信息(号码,内存,CPU,分辨率,MAC,IP,SD卡,IMEI,经纬度,信号强度等等)
- 在Android中创建菜单项Menu以及获取手机分辨率的解决方法
- android 获取手机内存及 内存可用空间的方法
- Android获取手机屏幕宽高、状态栏高度以及字符串宽高信息的方法
- 解析Android获取系统cpu信息,内存,版本,电量等信息的方法详解
- Android通过反射的方法获取手机存储设备的状态信息
- Android端如何获取手机当前的网络状态,比如wifi还是3G, 还是2G, 电信还是联通,还是移动
- Android 最新获取手机内置存储大小,SD卡存储空间大小方法
- Android部分手机拍照后获取的图片被旋转问题的解决方法
- Android获取手机文件夹及文件列表的方法
- Android应用开发获取手机电池电量的简单方法
- 获取android手机当前网络链接IP的方法
- Android获取手机联系人的方法
- [转]Android笔记:Android判断用户是平板还是手机的方法
- 解析Android获取系统cpu信息,内存,版本,电量等信息的方法详解
- Android手机获取QQ闪照的方法
- Android开发之获取手机屏幕DisplayMetrics属性方法
- 处理android手机html5页面中,点击text文本框无法自动获取焦点的处理方法