{"id":970,"date":"2014-09-19T22:54:26","date_gmt":"2014-09-19T14:54:26","guid":{"rendered":"http:\/\/ftp80491.host171.zhujiwu.cn\/?p=970"},"modified":"2022-05-27T16:27:48","modified_gmt":"2022-05-27T08:27:48","slug":"android%e8%87%aa%e5%8a%a8%e5%8c%96%e6%80%a7%e8%83%bd%e6%94%b6%e9%9b%86","status":"publish","type":"post","link":"https:\/\/www.yeetrack.com\/?p=970","title":{"rendered":"Android\u81ea\u52a8\u5316\u6027\u80fd\u6536\u96c6"},"content":{"rendered":"<p style=\"color: #373737;\">Android \u529f\u80fd\u6d4b\u8bd5\u81ea\u52a8\u5316\u6846\u67b6\u8f83\u591a\uff0cUIAutomator\uff0cRobotium\uff0cAppium\u7b49\u3002Case\u6267\u884c\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u5e0c\u671b\u6536\u96c6\u624b\u673a\u7684\u6027\u80fd\u6307\u6807\uff0c\u5305\u62ec\u5185\u5b58\u3001cpu\u3001\u6d41\u91cf\u7b49\u3002\u4f7f\u7528java+shell+bat\u7b80\u5355\u5b9e\u73b0\u4e86android\u624b\u673a\u6027\u80fd\u6536\u96c6\u3002<\/p>\n<h2>\u7b80\u8ff0<\/h2>\n<p style=\"color: #373737;\">\u8fc7\u7a0b\u5f88\u7b80\u5355\uff1a<\/p>\n<ul style=\"color: #373737;\">\n<li>\u5728\u542f\u52a8\u81ea\u52a8\u5316case\u524d\uff0c\u6267\u884c\u6536\u96c6\u4fe1\u606f\u7684\u547d\u4ee4\u3002\n<p style=\"font-weight: inherit;\">\u5176\u5b9e\u5c31\u662f\u4e00\u4e9badb shell\u547d\u4ee4\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre><code>      adb shell top -n 1| awk '{print $3\" \"$10}' &gt;&gt; cpu.dat  \n      adb shell ps | awk '{print $5\" \"$9}' &gt;&gt; mem.dat  \n\n      \/\/android sdk level \u5927\u4e8e16  \n      adb shell cat \/proc\/uid_stat\/$uid\/tcp_rcv &gt;&gt; $uid\"_recv.dat\"  \n      adb shell cat \/proc\/uid_stat\/$uid\/tcp_snd &gt;&gt; $uid\"_snd.dat\"  \n\n      \/\/android sdk level \u5c0f\u4e8e16   <span id=\"more-971\"><\/span>\n\n\n      adb shell cat \/proc\/$pid\/net\/dev | grep wlan | awk '{print $2\" \"$10}' &gt;&gt; $pid\"_net.dat\"  \n<\/code><\/pre>\n<\/li>\n<p>\t<!--more--><\/p>\n<li>\u6267\u884c\u81ea\u52a8\u5316case\uff0c\u53ef\u80fd\u9700\u8981\u5f88\u4e45\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u4e0a\u9762\u7684\u547d\u4ee4\u5728\u4e0d\u65ad\u5730\u6267\u884c<\/li>\n<li>case\u6267\u884c\u7ed3\u675f\uff0ckill\u6389\u7b2c\u4e00\u6b65\u4e2d\u7684\u547d\u4ee4<\/li>\n<li>\u5206\u6790\u6536\u96c6\u5230\u7684dat\u6587\u4ef6\uff0c\u4f7f\u7528jscharts\u7ed8\u51fa\u8d70\u52bf\u56fe<\/li>\n<\/ul>\n<h2>\u811a\u672c<\/h2>\n<h3 style=\"color: #373737;\">CPU<\/h3>\n<p style=\"color: #373737;\">\u4f7f\u7528top\u547d\u4ee4\u4e0d\u65ad\u67e5\u770b\u5404\u8fdb\u7a0b\u7684cpu\u5360\u7528<\/p>\n<h4 style=\"color: #373737;\">linux<\/h4>\n<p style=\"color: #373737;\">get-android-cpu.sh<\/p>\n<pre style=\"color: #373737;\"><code>    #!\/bin\/sh\n\n    #path--target\/android-info\/mem\/dat\n    cd ..\/..\/..\/\n    mkdir -p target\/android-info\/cpu\/dat\n    mkdir -p target\/android-info\/cpu\/html\n\n    cp src\/main\/resources\/jscharts.js target\/android-info\/cpu\/html\n    cd target\/android-info\/cpu\/dat\n\n    while true\n    do\n        adb shell top -n 1| awk '{print $3\" \"$10}' &gt;&gt; cpu.dat\n        sleep 15\n    done\n<\/code><\/pre>\n<h4 style=\"color: #373737;\">windows<\/h4>\n<p style=\"color: #373737;\">get-android-cpu.bat<\/p>\n<pre style=\"color: #373737;\"><code>    cd ..\\..\\jenkins\\workspace\\android-info-end3\n    mkdir target\\android-info\\cpu\\dat\n    mkdir target\\android-info\\cpu\\html\n\n    copy src\\main\\resources\\jscharts.js target\\android-info\\cpu\\html\n    cd target\\android-info\\cpu\\dat\n\n    :run\n        adb shell top -n 1 | awk \"{print $3\\\" \\\"$10}\" &gt;&gt; cpu.dat\n        ping 127.0.0.1 -n 15 &gt; null\n    goto run\n<\/code><\/pre>\n<h3 style=\"color: #373737;\">MEMORY<\/h3>\n<p style=\"color: #373737;\">\u4f7f\u7528ps\u547d\u4ee4\u4e0d\u65ad\u67e5\u770b\u5404\u8fdb\u7a0b\u7684\u5185\u5b58\u5360\u7528<\/p>\n<h4 style=\"color: #373737;\">linux<\/h4>\n<p style=\"color: #373737;\">get-android-mem.sh<\/p>\n<pre style=\"color: #373737;\"><code>    #!\/bin\/sh\n\n    #path--target\/android-info\/mem\/dat\n    cd ..\/..\/..\/\n    mkdir -p target\/android-info\/mem\/dat\n    mkdir -p target\/android-info\/mem\/html\n    cp src\/main\/resources\/jscharts.js target\/android-info\/mem\/html\n    cd target\/android-info\/mem\/dat\n\n    while true\n    do\n        adb shell ps | awk '{print $5\" \"$9}' &gt;&gt; mem.dat\n        sleep 15\n    done\n<\/code><\/pre>\n<h4 style=\"color: #373737;\">windows<\/h4>\n<pre style=\"color: #373737;\"><code>    cd ..\\..\\jenkins\\workspace\\android-info-end3\n    mkdir target\\android-info\\mem\\dat\n    mkdir target\\android-info\\mem\\html\n    copy src\\main\\resources\\jscharts.js target\\android-info\\mem\\html\n\n    cd target\\android-info\\mem\\dat\n\n    :run\n        adb shell ps | awk \"{print $5\\\" \\\"$9}\" &gt;&gt; mem.dat\n        ping 127.0.0.1 -n 15 &gt; null\n    goto run\n<\/code><\/pre>\n<h3 style=\"color: #373737;\">\u6d41\u91cf<\/h3>\n<p style=\"color: #373737;\">android 4.0\u4ee5\u4e0a\u7248\u672c\u53ef\u4ee5\u7528<code>\/proc\/uid_stat\/$uid\/tcp_rcv<\/code>\u548c<code>\/proc\/uid_stat\/$uid\/tcp_snd<\/code>\u6765\u83b7\u53d6\u67d0\u4e2a\u7a0b\u5e8f\u7684\u4e0a\u4e0b\u884c\u6d41\u91cf\uff1b\u800c4.0\u4ee5\u4e0b\u7248\u672c\u8981\u7528<code>cat \/proc\/$pid\/net\/dev<\/code>\u6765\u67e5\u770b\u4e0a\u4e0b\u884c\u6d41\u91cf\u3002uid\u548cpid\u7684\u5173\u7cfb\uff0c\u53ef\u4ee5\u4ece<code>\/data\/system\/packages.list<\/code>\u8fd9\u4e2a\u6587\u4ef6\u4e2d\u83b7\u53d6\u3002<\/p>\n<h4 style=\"color: #373737;\">linux<\/h4>\n<p style=\"color: #373737;\">\u5224\u65adandroid api level\uff1a<\/p>\n<pre style=\"color: #373737;\"><code>    #!\/bin\/sh\n    #android 4.0\u4ee5\u4e0a\u548c4.0\u4ee5\u4e0b\u65b9\u6cd5\u4e0d\u540c\n    #get android sdk level\n    apileveltemp=`adb shell getprop | grep ro.build.version.sdk`\n    apilevel=${apileveltemp:25:2}\n    chmod +x *.sh\n\n    echo \"android api level:\"$apilevel\n    if [ $apilevel -gt 14 ]\n    then\n        .\/get-android-net-gt-4.0.sh\n    elif [ $apilevel -lt 14 ]\n    then\n        .\/get-android-net-lt-4.0.sh\n    fi\n<\/code><\/pre>\n<p style=\"color: #373737;\">get-android-net-gt-4.0.sh<\/p>\n<pre style=\"color: #373737;\"><code>    #!\/bin\/sh\n\n    #android api level great than 14(android 4.0)\n    #path--target\/android-info\/net\/dat\n    cd ..\/..\/..\/\n    mkdir -p target\/android-info\/net\/dat\n    mkdir -p target\/android-info\/net\/html\n    cp src\/main\/resources\/jscharts.js target\/android-info\/net\/html\n    cd target\/android-info\/net\/dat\n\n    cd ..\n    echo \"adb pull\/data\/system\/packages.list--start\"\n    adb pull \/data\/system\/packages.list\n    cd dat\n\n    while true\n    do\n\n        echo \"get net info from \/proc\/uid-stat\/$uid\"\n        for i in `adb shell ls \/proc\/uid_stat`\n        do\n            #delete the Enter character\n            uid=`echo $i | tr -d [\"\\r\\n\"]`\n            adb shell cat \/proc\/uid_stat\/$uid\/tcp_rcv &gt;&gt; $uid\"_recv.dat\"\n            adb shell cat \/proc\/uid_stat\/$uid\/tcp_snd &gt;&gt; $uid\"_snd.dat\"\n        done\n        sleep 15\n    done\n<\/code><\/pre>\n<p style=\"color: #373737;\">get-android-net-lt-4.0.sh<\/p>\n<pre style=\"color: #373737;\"><code>    #!\/bin\/sh\n\n\n    #path--target\/android-info\/net\/dat\n    cd ..\/..\/..\/\n    mkdir -p target\/android-info\/net\/dat\n    mkdir -p target\/android-info\/net\/html\n    cp src\/main\/resources\/jscharts.js target\/android-info\/net\/html\n    cd target\/android-info\/net\/dat\n\n    #get \/proc\/$pid\/net\/dev\n    while true\n    do\n        #get pid\n        for i in `adb shell ps | awk '{print $2}'`\n        do\n            pid=`echo $i | tr -d [\"\\r\\n\"]`\n            echo $pid\n            adb shell cat \/proc\/$pid\/net\/dev | grep wlan | awk '{print $2\" \"$10}' &gt;&gt; $pid\"_net.dat\"\n        done\n\n        sleep 15\n    done\n<\/code><\/pre>\n<h4 style=\"color: #373737;\">windows<\/h4>\n<p style=\"color: #373737;\">bat\u547d\u4ee4\u4e0d\u719f\uff0c\u4e0d\u77e5\u9053\u5982\u4f55\u5728windows\u4e0b\u5b9e\u73b0linux\u4e0b\u5730\u53cd\u8f6c\u4e49\uff0c\u8fd9\u91cc\u7528java\u4ee3\u7801\u5b9e\u73b0\u3002<\/p>\n<pre style=\"color: #373737;\"><code>    import java.io.*;\n\n    \/**\n     * Created by Xuemeng Wang on 14-9-15.\n     * api Level &gt; 16\n     *\/\n    public class GetNetInfo {\n        public static void main(String[] args) {\n\n            String uidString = execCmd(\"adb shell ls \/proc\/uid_stat\");\n            String[] uidArray = uidString.split(\"\\n\");\n            int length = uidArray.length-1;\n            for(int i=0;i&lt;=length-1;i++)\n            {\n                String contentRcv = execCmd(\"adb shell cat \/proc\/uid_stat\/\"+uidArray[i]+\"\/tcp_rcv\");\n                String contentSnd = execCmd(\"adb shell cat \/proc\/uid_stat\/\"+uidArray[i]+\"\/tcp_snd\");\n                System.out.println(System.getProperty(\"user.dir\"));\n                try {\n                    File file = new File(uidArray[i]+\"_recv.dat\");\n                    if(!file.exists()) file.createNewFile();\n\n                    File file2 = new File(uidArray[i]+\"_snd.dat\");\n                    if(!file2.exists()) file2.createNewFile();\n\n                    FileWriter fileWriter1 = new FileWriter(file, true);\n                    FileWriter fileWriter2 = new FileWriter(file2, true);\n                    fileWriter1.write(contentRcv);\n                    fileWriter2.write(contentSnd);\n                    fileWriter1.close();\n                    fileWriter2.close();\n                } catch (IOException e) {\n                    e.printStackTrace();\n                }\n            }\n        }\n        public static String execCmd(String command)\n        {\n            BufferedReader br = null;\n            StringBuffer stringBuffer = new StringBuffer();\n            try {\n                Process p = Runtime.getRuntime().exec(command);\n                br = new BufferedReader(new InputStreamReader(p.getInputStream()));\n                String line = null;\n                while ((line = br.readLine()) != null) {\n                if(\"\".equals(line.trim())) continue;\n\n                    stringBuffer.append(line+\"\\n\");\n                }\n            } catch (Exception e) {\n                e.printStackTrace();\n            } finally {\n\n                if (br != null) {\n                    try {\n                        br.close();\n                    } catch (Exception e) {\n                        e.printStackTrace();\n                    }\n                }\n            }\n            return stringBuffer.toString();\n        }\n    }\n<\/code><\/pre>\n<p style=\"color: #373737;\">api level\u5c0f\u4e8e16\u7684\u60c5\u51b5\uff0c\u6211\u6ca1\u7528\u5230\uff0c\u7565\u6389:)\u3002<\/p>\n<h3 style=\"color: #373737;\">\u6740\u6389\u8fdb\u7a0b<\/h3>\n<p style=\"color: #373737;\">linux:\u00a0<code>ps -ef | grep get-android- | grep -v grep | awk '{print $2}' | xargs kill -9<\/code><\/p>\n<p style=\"color: #373737;\">windows(\u540e\u53f0\u8fd0\u884c\uff0c\u5176\u5b9e\u662fcmd\u8fdb\u7a0b\uff0c\u6ce8\u610f\u4e0b\u9762\u4f1a\u6740\u6389\u6240\u6709\u7684cmd\u8fdb\u7a0b):<\/p>\n<pre style=\"color: #373737;\"><code>    taskkill \/F \/IM cmd.exe\n    taskkill \/F \/IM adb.exe\n<\/code><\/pre>\n<h2>\u7ed3\u679c\u6536\u96c6<\/h2>\n<p style=\"color: #373737;\">\u4f7f\u7528java\u5206\u6790dat\uff0c\u7ed9\u51fa\u5206\u6790cpu\u7684\u4ee3\u7801\uff0c\u5de5\u7a0b\u5df2\u4e0a\u4f20\u5230github,<a style=\"color: #11598f;\" href=\"https:\/\/github.com\/yeetrack\/android-performance\">https:\/\/github.com\/yeetrack\/android-performance<\/a>\u3002<\/p>\n<p style=\"color: #373737;\">CpuInfo.java<\/p>\n<pre style=\"color: #373737;\"><code>    package com.meilishuo.android.performance;\n\n    import org.slf4j.Logger;\n    import org.slf4j.LoggerFactory;\n    import org.testng.annotations.Test;\n\n    import java.io.*;\n    import java.util.ArrayList;\n    import java.util.Iterator;\n    import java.util.List;\n    import java.util.TreeMap;\n\n    \/**\n     * Created by victor on 14-9-9.\n    *\/\n    public class CpuInfo {\n        private static final Logger logger = LoggerFactory.getLogger(MemInfo.class);\n        private static final String JSCHARTPATH = \"target\/android-info\/cpu\/html\/\";\n        private static final String MEMFILEPATH = \"target\/android-info\/cpu\/dat\/cpu.dat\";\n\n        TreeMap&lt;String, List&lt;String&gt;&gt; cpuMap = new TreeMap&lt;String, List&lt;String&gt;&gt;();\n\n        \/**\n        * \u89e3\u6790cpu.dat\u5b58\u50a8\u5230map\u4e2d\n        *\/\n        public void parseCpuFile()\n        {\n            File file = new File(MEMFILEPATH);\n            if(null==file) return;\n\n            try {\n                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));\n                String line = null;\n\n                while((line=bufferedReader.readLine())!=null)\n                {\n                    String[] array = line.trim().split(\" \"); \/\/\u7a7a\u683c\u5206\u9694\n                    if(null==array || array.length!=2 || !array[0].contains(\"%\") || \"\".equals(array[1]) || \"Name\".equals(array[1]))\n                        continue;\n                    if(cpuMap.size()==0 || !cpuMap.containsKey(array[1]))\n                    {\n                        List&lt;String&gt; memList = new ArrayList&lt;String&gt;();\n                        memList.add(array[0].substring(0, array[0].indexOf(\"%\")));\n                        cpuMap.put(array[1], memList);\n                    }\n                    else\n                    {\n                        cpuMap.get(array[1]).add(array[0].substring(0, array[0].indexOf(\"%\")));\n                    }\n                }\n                System.out.println(cpuMap.size());\n            } catch (FileNotFoundException e) {\n                e.printStackTrace();\n            } catch (IOException e) {\n                e.printStackTrace();\n            }\n        }\n\n        \/**\n        * \u5c06map\u4e2d\u7684\u6570\u636e\u5199\u5230\u5230xml\u4e2d\n        *\/\n        public void writeXmlFromMap()\n        {\n            if(null==cpuMap || cpuMap.size()==0)\n                return;\n            Iterator&lt;String&gt; it = cpuMap.keySet().iterator();\n            while(it.hasNext())\n            {\n                String key = it.next();\n                List&lt;String&gt; value = cpuMap.get(key);\n                if(null==value || value.size()&lt;=1)\n                    continue;\n                \/\/\u5199\u5165xml\n                File file = new File(JSCHARTPATH+key.replace(\"\/\", \"_\").replace(\":\", \"_\")+\"_cpu.xml\");\n                try {\n                    BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));\n                    bufferedWriter.write(\n                    \"&lt;?xml version=\\\"1.0\\\"?&gt;\\n\" +\n                            \"&lt;JSChart&gt;\\n\" +\n                            \"\\t&lt;dataset type=\\\"line\\\"&gt;\");\n                    int pos = 1;\n                    for(String index : value)\n                    {\n                        bufferedWriter.write(\"&lt;data unit=\\\"\"+pos+\"\\\" value=\\\"\"+index+\"\\\"\/&gt;\\n\");\n                        pos++;\n                    }\n                    bufferedWriter.write(\n                    \"&lt;\/dataset&gt;\\n\" +\n                            \"\\t&lt;optionset&gt;\\n\" +\n                            \"\\t\\t&lt;option set=\\\"setLineColor\\\" value=\\\"'#8D9386'\\\"\/&gt;\\n\" +\n                            \"\\t\\t&lt;option set=\\\"setLineWidth\\\" value=\\\"4\\\"\/&gt;\\n\" +\n                            \"\\t\\t&lt;option set=\\\"setTitleColor\\\" value=\\\"'#7D7D7D'\\\"\/&gt;\\n\" +\n                            \"\\t\\t&lt;option set=\\\"setAxisColor\\\" value=\\\"'#9F0505'\\\"\/&gt;\\n\" +\n                            \"\\t\\t&lt;option set=\\\"setGridColor\\\" value=\\\"'#a4a4a4'\\\"\/&gt;\\n\" +\n                            \"\\t\\t&lt;option set=\\\"setAxisValuesColor\\\" value=\\\"'#333639'\\\"\/&gt;\\n\" +\n                            \"\\t\\t&lt;option set=\\\"setAxisNameColor\\\" value=\\\"'#333639'\\\"\/&gt;\\n\" +\n                            \"\\t\\t&lt;option set=\\\"setTextPaddingLeft\\\" value=\\\"0\\\"\/&gt;\\n\" +\n                            \"\\t&lt;\/optionset&gt;\\n \" +\n                            \"&lt;\/JSChart&gt;\");\n                    bufferedWriter.flush();\n                    bufferedWriter.close();\n                } catch (FileNotFoundException e) {\n                    e.printStackTrace();\n                } catch (IOException e) {\n                    e.printStackTrace();\n                }\n            }\n        }\n\n        \/**\n        * \u751f\u6210jschart html\u6587\u4ef6\n        *\/\n        public void writeJsHtml()\n        {\n            File file = new File(JSCHARTPATH);\n            File[] xmlFiles = file.listFiles(new FileFilter() {\n                @Override\n                public boolean accept(File pathname) {\n                    return pathname.getName().endsWith(\"_cpu.xml\");\n                }\n            });\n            if(null== xmlFiles || xmlFiles.length==0) return;\n            for(File index : xmlFiles)\n            {\n                File htmlFile = new File(index.getAbsolutePath().replace(\".xml\", \".html\"));\n                try {\n                    BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(htmlFile));\n                    bufferedWriter.write(\n                    \"&lt;html&gt;\\n\" +\n                            \"&lt;head&gt;\\n\" +\n                            \"\\n\" +\n                            \"&lt;title&gt;JSChart&lt;\/title&gt;\\n\" +\n                            \"\\n\" +\n                            \"&lt;script type=\\\"text\/javascript\\\" src=\\\"jscharts.js\\\"&gt;&lt;\/script&gt;\\n\" +\n                            \"\\n\" +\n                            \"&lt;\/head&gt;\\n\" +\n                            \"&lt;body&gt;\\n\" +\n                            \"&lt;div id=\\\"result\\\"&gt;\\n\" +\n                            \"&lt;h3&gt;\"+htmlFile.getName().replace(\".xml\", \"\")+\"&lt;\/h3&gt;\" +\n                            \"&lt;div id=\\\"graph\\\"&gt;Loading graph...&lt;\/div&gt;\\n\" +\n                            \"\\n\" +\n                            \"&lt;script type=\\\"text\/javascript\\\"&gt;\\n\" +\n                            \"\\t\\n\" +\n                            \"\\tvar myChart = new JSChart('graph', 'line');\\n\" +\n                            \"\\tmyChart.setDataXML(\\\"\"+index.getName()+\"\\\");\\n\" +\n                            \"\\tmyChart.draw();\\n\" +\n                            \"\\t\\n\" +\n                            \"&lt;\/script&gt;\\n\" +\n                            \"\\n\" +\n                            \"\\n\" +\n                            \"&lt;\/div&gt;\\n\" +\n                            \"&lt;\/body&gt;\\n\" +\n                            \"&lt;\/html&gt;\\n\"\n                    );\n                    bufferedWriter.flush();\n                    bufferedWriter.close();\n\n                } catch (IOException e) {\n                    e.printStackTrace();\n                }\n            }\n        }\n\n        public void writeAllJsHtml()\n        {\n            File[] files = new File(JSCHARTPATH).listFiles(new FileFilter() {\n                @Override\n                public boolean accept(File pathname) {\n                    return pathname.getName().endsWith(\"_cpu.html\");\n                }\n            });\n            if(files.length==0) return;\n\n            File allHtmlFile = new File(JSCHARTPATH+\"all_cpu.html\");\n            if(allHtmlFile.exists())\n                allHtmlFile.delete();\n\n            try {\n                allHtmlFile.createNewFile();\n                BufferedWriter out = new BufferedWriter(new FileWriter(allHtmlFile, true));\n                String header =\n                \"&lt;!DOCTYPE html&gt;\\n\" +\n                        \"&lt;html&gt;\\n\" +\n                        \"&lt;head lang=\\\"en\\\"&gt;\\n\" +\n                        \"    &lt;meta charset=\\\"UTF-8\\\"&gt;\\n\" +\n                        \"    &lt;title&gt;cpu\u4f7f\u7528\u7387&lt;\/title&gt;\\n\" +\n                        \"&lt;\/head&gt;\\n\" +\n                        \"&lt;body&gt;\\n\" +\n                        \"&lt;h1&gt; cpu\u4f7f\u7528\u7387&lt;\/h1&gt;\\n\";\n                out.write(header);\n\n\n                for(File index : files)\n                {\n                    String fileName = index.getName();\n\n                    out.write(\"&lt;iframe src=\\\"\"+fileName+\"\\\" width=\\\"100%\\\" height=\\\"500\\\"&gt;&lt;\/iframe&gt;&lt;br&gt;\\n\");\n\n                }\n\n                out.write(\"&lt;\/body&gt;\\n&lt;\/html&gt;\");\n                out.close();\n            } catch (IOException e) {\n                e.printStackTrace();\n            }\n        }\n\n        @Test\n        public void generateCpuHtmlInfo()\n        {\n            CpuInfo cpuInfo = new CpuInfo();\n            cpuInfo.parseCpuFile();\n            cpuInfo.writeXmlFromMap();\n            cpuInfo.writeJsHtml();\n            cpuInfo.writeAllJsHtml();\n        }\n    }\n<\/code><\/pre>\n<h2>jenkins\u95ee\u9898<\/h2>\n<ul style=\"color: #373737;\">\n<li>\u6267\u884c\u81ea\u52a8\u5316\u524d\uff0c\u8c03\u7528shell\u3001bat\u6587\u4ef6\u5fc5\u987b\u5728\u540e\u53f0\u8fd0\u884c\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cjenkins\u542f\u52a8\u7684\u8fdb\u7a0b\u4f1a\u963b\u585e\u540e\u9762\u8fdb\u7a0b\u6267\u884c\u3002jenkins\u652f\u6301\u540e\u53f0\u542f\u52a8\u8fdb\u7a0b\uff0c\u53c2\u8003\u94fe\u63a5\uff1a<a style=\"color: #11598f;\" href=\"https:\/\/www.yeetrack.com\/?p=965\">Jenkins\u542f\u52a8\u5b88\u62a4\u8fdb\u7a0b\u540e\u53f0\u6301\u7eed\u8fd0\u884c<\/a><\/li>\n<li>windows\u5728\u4f7f\u7528at\u542f\u52a8\u5b9a\u65f6\u4efb\u52a1\u65f6\uff0c\u5f53\u524d\u7684\u8def\u5f84\u662f<strong>C:\\Windows\\system32<\/strong>\uff08\u5176\u5b9e\u5c31\u662fcmd.exe\u7684\u8def\u5f84\uff09\uff0c\u5f53\u65f6\u8fd9\u4e2a\u5ffd\u7565\uff0c\u5404\u79cd\u8def\u5f84\u95ee\u9898\u3002<\/li>\n<li>windows\u4f7f\u7528at\u547d\u4ee4\u6267\u884cbat\u811a\u672c\uff0c\u53d1\u73b0<code>java<\/code>,<code>javac<\/code>\u7b49\u547d\u4ee4\u6267\u884c\u65e0\u53cd\u5e94\uff0c\u4e0d\u77e5\u9053\u4e3a\u4f55\uff08\u73af\u5883\u53d8\u91cf\u914d\u4e86\uff0cjenkins\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528java\u7b49\u547d\u4ee4\uff09\uff0c\u540e\u6765\u53d1\u73b0\u5c06\u8def\u5f84\u5199\u540e\u6267\u884c\u6210\u529f\u3002<\/li>\n<li>\u6700\u540e\u6ce8\u610f\u4e00\u70b9\uff0c\u4e00\u5b9a\u8981\u8bb0\u5f97kill\u6389\u540e\u53f0\u7684\u8fdb\u7a0b\uff0c\u5426\u5219\u6587\u4ef6\u5199\u6ee1\u786c\u76d8\uff0c:)\u3002<\/li>\n<\/ul>\n<p style=\"color: #373737;\">\u9644\u4e0a\u751f\u6210\u7684html\u793a\u4f8b\u5730\u5740\uff1a<a style=\"color: #11598f;\" href=\"https:\/\/github.com\/yeetrack\/android-performance\/tree\/master\/target\/android-info\/cpu\/html\">https:\/\/github.com\/yeetrack\/android-performance\/tree\/master\/target\/android-info\/cpu\/html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android \u529f\u80fd\u6d4b\u8bd5\u81ea\u52a8\u5316\u6846\u67b6\u8f83\u591a\uff0cUIAutomator\uff0cRobotium\uff0cAppium\u7b49\u3002Case\u6267\u884c\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u5e0c\u671b\u6536\u96c6\u624b\u673a\u7684\u6027\u80fd\u6307\u6807\uff0c\u5305\u62ec\u5185\u5b58\u3001cpu\u3001\u6d41\u91cf\u7b49\u3002\u4f7f\u7528java+shell+b&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pgc_sgb_lightbox_settings":"","footnotes":""},"categories":[34],"tags":[],"class_list":["post-970","post","type-post","status-publish","format-standard","hentry","category-software"],"views":4227,"_links":{"self":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/970","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=970"}],"version-history":[{"count":2,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/970\/revisions"}],"predecessor-version":[{"id":972,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/970\/revisions\/972"}],"wp:attachment":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}