缩放当前频率不显示适当的结果

时间:2013-05-16 07:22:10

标签: android

我正在使用cat / sys / devices / system / cpu / cpu0 / cpufreq / scaling_cur_freq来提取当前频率。但是每当我运行此命令时,我都会设置最大频率,而当我从DDMS中拉出时,文件会显示不同的频率。你能说出可能出现的错误吗?

我的代码:

public String getCurrentCPU()
    {
        Process process;
        try{
        Runtime rt = Runtime.getRuntime();
        process=rt.exec("cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq");
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(process.getInputStream()));
        int read;
        char[] buffer = new char[4096];
        StringBuffer output = new StringBuffer();
        while ((read = reader.read(buffer)) > 0) {
            output.append(buffer, 0, read);
        }        
        reader.close();
        process.destroy();
        //process.waitFor();
        return output.toString();
        }       catch (IOException e) {
            throw new RuntimeException(e);
        } 
    }

0 个答案:

没有答案