Is there any Java API for that? How can I read this information.
+3
A:
not MHz, but at least something. bogoMIPS value can be useful for you.
private String ReadCPUinfo()
{
ProcessBuilder cmd;
String result="";
try{
String[] args = {"/system/bin/cat", "/proc/cpuinfo"};
cmd = new ProcessBuilder(args);
Process process = cmd.start();
InputStream in = process.getInputStream();
byte[] re = new byte[1024];
while(in.read(re) != -1){
System.out.println(new String(re));
result = result + new String(re);
}
in.close();
} catch(IOException ex){
ex.printStackTrace();
}
return result;
}
zed_0xff
2010-06-11 07:51:30
Thanks, but is there any way to convert it to MHz or read it somewhere?
michael
2010-06-11 16:18:44
Any reason you're not just opening /proc/cpuinfo as a file and reading it directly?
fadden
2010-06-11 23:38:58
michael, read a wiki page about bogoMIPS, there's a formula. fadden, I'm not sure that file could be simply read from java, just found this code laying around.
zed_0xff
2010-06-12 13:22:48
+2
A:
To have frequency on Android, just read these special files in /sys directory:
#cat "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
#cat "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq"
#cat "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
You will have current, min and max Frequency allowed.
Ellis
2010-09-24 17:49:28