1 查看手机CPU信息
cmd——adb shell——cd /proc------cat cpuinfo
2 获取cpu的是arm指令集,armv7指令集、还是neon指令集
- public static Object[] getCpuArchitecture() {
- if ((Integer) mArmArchitecture[1] != -1) {
- return mArmArchitecture;
- }
- try {
- InputStream is = new FileInputStream("/proc/cpuinfo");
- InputStreamReader ir = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(ir);
- try {
- String nameProcessor = "Processor";
- String nameFeatures = "Features";
- String nameModel = "model name";
- String nameCpuFamily = "cpu family";
- while (true) {
- String line = br.readLine();
- String[] pair = null;
- if (line == null) {
- break;
- }
- pair = line.split(":");
- if (pair.length != 2)
- continue;
- String key = pair[0].trim();
- String val = pair[1].trim();
- if (key.compareTo(nameProcessor) == 0) {
- String n = "";
- for (int i = val.indexOf("ARMv") + 4; i < val.length(); i++) {
- String temp = val.charAt(i) + "";
- if (temp.matches("\\d")) {
- n += temp;
- } else {
- break;
- }
- }
- mArmArchitecture[0] = "ARM";
- mArmArchitecture[1] = Integer.parseInt(n);
- continue;
- }
-
- if (key.compareToIgnoreCase(nameFeatures) == 0) {
- if (val.contains("neon")) {
- mArmArchitecture[2] = "neon";
- }
- continue;
- }
-
- if (key.compareToIgnoreCase(nameModel) == 0) {
- if (val.contains("Intel")) {
- mArmArchitecture[0] = "INTEL";
- mArmArchitecture[2] = "atom";
- }
- continue;
- }
-
- if (key.compareToIgnoreCase(nameCpuFamily) == 0) {
- mArmArchitecture[1] = Integer.parseInt(val);
- continue;
- }
- }
- } finally {
- br.close();
- ir.close();
- is.close();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return mArmArchitecture;
- }
获取CPU信息
原文:http://www.cnblogs.com/lucktian/p/5689625.html