开发者

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

开发者 https://www.devze.com 2023-02-09 03:41 出处:网络
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\" };

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

精彩评论

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