-/sys/devices/system/cpu/디렉토리 아래의 파일을보고 CPU 코어 수를 확인할 수 있습니다. 이것은 뿌리가없는 전화기에서도 가능합니다.
public int getNumOfCpus() {
class CPUFilter implements FileFilter {
@Override
public boolean accept(File pathname) {
// Check if filename is "cpu0", "cpu1,...
if (Pattern.matches("cpu[0-9]", pathname.getName())) {
return true;
}
return false;
}
}
try {
// Get directory containing CPU info
File dir = new File("/sys/devices/system/cpu/");
File[] files = dir.listFiles(new CPUFilter());
// Return the number of cores
return files.length;
} catch (Exception e) {
e.printStackTrace();
return 1;
}
}
당신은 여기에 대한 대답에 언급 된 기능을 수정하여 코어 당 CPU 사용률을 얻을 수 있습니다 - - 여기 장치에 당신에게 코어의 수를 줄 수있는 기능입니다 Get Memory Usage in Android
딜런 M, 공유는 제발 제발! –