android-discuss
android-discuss copied to clipboard
[问答]通过top命令获取应用 cpu使用率> > 100
for(int i = 0; i < rows.length; i++) {
String line = rows[i].trim();
String[] columns = line.split(StrConstants.BLANK_SPLIT);
if(line.indexOf(pkgName) != -1) {
if(columns != null && columns.length >= 9) {
try {
rate += Integer.parseInt(columns[2].trim().replace("%", ""));
}
catch (Exception e) {
e.printStackTrace();
}
}
}
通过以上代码,获得cpu使用率有远远大于100的。 在网络上查询的资料说多核的话是可能大于100的,但是最大值居然有1899,没有手机是19核吧