@Deprecated
    public static String getCpuUsagePercent() {
        java.lang.Process p = null;
        BufferedReader in = null;
        StringBuilder returnString = new StringBuilder();
        try {
            p = Runtime.getRuntime().exec("top -n 1");
            in = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line;
            while ((line = in.readLine()) != null) {
                returnString.append(line);
            }
        } catch (IOException e) {
            XLog.e("error in getting first line of top");
            e.printStackTrace();
        } finally {
            IoUtils.closeQuietly(in);
            IoUtils.closeQuietly(p);
        }
        return returnString.toString();
    }
Created by guohao4 on 2017/10/24.
Email: Tornaco@163.com
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/util/OsUtils.java