Rak*_*dav 6 cpu android processor info
我想让处理器模型与DU Booster类似.CPU模型包含ARM处理器版本和修订版.例如:ARMv7 Processor rev 3(v7l)
我试过这只
System.getProperty("os.arch")返回架构
和
String[] args = {"/system/bin/cat", "/proc/cpuinfo"};
Run Code Online (Sandbox Code Playgroud)
获取CPU信息.我能够在某些设备中获得正确的信息,但不是全部.
我在华硕Fonepad 7中尝试了这个,它不返回处理器的属性(但返回处理器(小p)
它返回就像
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 53
model name : Intel(R) Atom(TM) CPU Z2520 @ 1.20GHz
stepping : 1
microcode : 0x10e
cpu MHz : 800.000
cache size : 512 KB
physical id : 0
siblings : 4
Run Code Online (Sandbox Code Playgroud)
我想获得像"ARMv7 Processor rev 3(v7l)"这样的结果.提前致谢..
Acu*_*una 12
您不需要实现分离的方法来处理不同的处理器类型,只需在获取文件时将model_name密钥替换为cpu_model需要的时间/proc/cpuinfo:
public static Map<String, String> getCPUInfo () throws IOException {
BufferedReader br = new BufferedReader (new FileReader ("/proc/cpuinfo"));
String str;
Map<String, String> output = new HashMap<> ();
while ((str = br.readLine ()) != null) {
String[] data = str.split (":");
if (data.length > 1) {
String key = data[0].trim ().replace (" ", "_");
if (key.equals ("model_name")) key = "cpu_model";
String value = data[1].trim ();
if (key.equals ("cpu_model"))
value = value.replaceAll ("\\s+", " ");
output.put (key, value);
}
}
br.close ();
return output;
}
Run Code Online (Sandbox Code Playgroud)