开发者

What is the most reliable way to determine the CPU clock frequency of Android phones?

I found some references and ended up with the following code:

String[] args = { "/system/bin/cat", "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq" };

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开发者_StackOverflow中文版(re));
    result = result + new String(re);
}
in.close();

The above code works pretty well but not all the time. I've gotten some reports that it reports higher than the frequency set by SetCPU at max setting on some phones.

Is there a more reliable way to find the clock speed of Android phones?


If you want to get the current frequency you can read from:

/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜