0
我们都知道Android操作系统支持多核心架构。但是,如何测试这些线程实际上是在多个内核上进行处理的?它是一个项目分配。请建议如何继续。如何查看Android操作系统真的使用多核心
public int numCores() throws IOException {
Pattern processorLinePattern = Pattern.compile("^processor\\s+: \\d+$", Pattern.MULTILINE);
String cpuinfo = Files.toString(new File("/proc/cpuinfo"), Charsets.US_ASCII);
Matcher matcher = processorLinePattern.matcher(cpuinfo);
int count = 0;
while (matcher.find()) {
count++;
}
return count;
}
通常你应该喜欢做与像番石榴或Apache下议院助手库I/O,有很多优势的情况下获得: