- //获得CPU最小赫兹
- public static double getCpuMinFreq()
- {
- double cpuMinFreq = 0;
- try
- {
- BufferedReader br = new BufferedReader(new FileReader("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq"));
- String text = "";
- while ((text = br.readLine()) != null)
- {
- text = text.trim();
- if (!"".equals(text.trim()))
- {
- cpuMinFreq = Double.parseDouble(text.trim()) / 1000;
- DeviceUtil.cpuMinFreq = cpuMinFreq;
- }
- break;
- }
- br.close();
- br = null;
- }
- catch(Exception e)
- {
- //MyLog.d(e.toString());
- }
- return cpuMinFreq;
- }
- //获得CPU最大赫兹
- public static double getCpuMaxFreq()
- {
- double cpuMaxFreq = 0;
- try
- {
- BufferedReader br = new BufferedReader(new FileReader("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"));
- String text = "";
- while ((text = br.readLine()) != null)
- {
- text = text.trim();
- if (!"".equals(text.trim()))
- {
- cpuMaxFreq = Double.parseDouble(text.trim()) / 1000;
- DeviceUtil.cpuMaxFreq = cpuMaxFreq;
- }
- break;
- }
- br.close();
- br = null;
- }
- catch(Exception e)
- {
- //MyLog.d(e.toString());
- }
- return cpuMaxFreq;
- }
转载于:https://blog.51cto.com/5397054/1111649