当前位置: 首页 > 工具软件 > auto-cpufreq > 使用案例 >

unity3d android 主线程,Unity3d 获取cpu主频 android

殳经略
2023-12-01

public static int getMaxCpuFreq() {

String kCpuInfoMaxFreqFilePath = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq";

int result = 1600000;

FileReader fr = null;

BufferedReader br = null;

try {

fr = new FileReader(kCpuInfoMaxFreqFilePath);

br = new BufferedReader(fr);

String text = br.readLine();

result = Integer.parseInt(text.trim());

} catch (FileNotFoundException e) {

// e.printStackTrace();

return 1600000;

} catch (IOException e) {

// e.printStackTrace();

return result;

} finally {

if (fr != null)

try {

fr.close();

} catch (IOException e) {

// TODO Auto-generated catch block

// e.printStackTrace();

return result;

if (br != null)

try {

br.close();

} catch (IOException e) {

// TODO Auto-generated catch block

// e.printStackTrace();

return result;

return result;

 类似资料: