{"id":51,"date":"2015-07-24T19:02:52","date_gmt":"2015-07-24T19:02:52","guid":{"rendered":"https:\/\/boochlin.com\/?p=51"},"modified":"2016-07-13T14:34:49","modified_gmt":"2016-07-13T14:34:49","slug":"analyzing-ui-performance-with-systrace","status":"publish","type":"post","link":"https:\/\/boochlin.com\/?p=51","title":{"rendered":"Analyzing UI Performance with Systrace"},"content":{"rendered":"<h4><\/h4>\n<p>\u5728\u4f60\u8eab\u70baanddroid \u5de5\u7a0b\u5e2b\u7684\u751f\u6daf\u4e2d\uff0c\u4e00\u5b9a\u66fe\u7d93\u6709\u4eba\u6703\u62ff\u8005\u624b\u6a5f\uff0c\u908a\u6ed1\u908a\u544a\u8a34\u4f60\uff0c\u9019\u500b\u600e\u67d0\u770b\u8d77\u4f86\u597d\u5361<br \/>\n\u7136\u5f8c\u8acb\u4f60\u4fee\u597d\u3002<br \/>\n\u300e\u597d\u5361\u300f\u4e00\u500b\u5f88\u4e3b\u89c0\u7684\u6558\u8ff0\uff0c\u7562\u7adf\u5361\u7684\u5b9a\u7fa9\u5927\u5bb6\u90fd\u4e0d\u4e00\u6a23\uff0c\u4f46\u662f\u5176\u5be6\u9019\u6709\u5f88\u8a73\u7d30\u7684\u5b9a\u7fa9<br \/>\n<strong>\u300e you should check that user interactions are buttery smooth, running at a consistent 60 frames per second.\u300f<\/strong><br \/>\n\u4e00\u79d260frames\uff0c\u9019\u6a23\u662f\u4eba\u5011\u80fd\u63a5\u53d7\u7684\u66f4\u65b0\u901f\u5ea6\uff0c\u4e5f\u5c31\u662f\u8655\u7406\u4e00\u500bframe\u5fc5\u9808\u58d3\u572816ms\u4ee5\u4e0b\u3002<\/p>\n<p><!--more--><br \/>\n\u56e0\u6b64RD\u9996\u5148\u8981\u78ba\u5b9a\u5c31\u662fview\u7684draw time \u662f\u5426\u5927\u65bc16ms\uff0c\u7576\u78ba\u5b9a\u9019\u6a23\u7684\u4e8b\u5be6\u4e4b\u5f8c\uff0c\u63a5\u4e0b\u4f86\u624d\u5fc5\u9808\u8981\u9700\u8981\u53bb\u5206\u6790\u9020\u6210\u6b64\u554f\u984c\u7684\u539f\u56e0\uff0c\u539f\u56e0\u7684\u53ef\u80fd\u6027\u592a\u591a\u4e86\uff0c\u53ef\u4ee5\u662fcpu , memory , disk access, emmc \u5404\u5f0f\u5404\u6a23\u7684\u554f\u984c\uff0candroid \u5167\u7684\u5e7e\u500b\u91cd\u8981\u95dc\u9375\u5143\u4ef6\uff0c\u6216\u8005\u5bebview\u7684\u662f\u500b\u5927\u7661\u3002<\/p>\n<p>\u800c\u5206\u6790\u6b64\u985e\u554f\u984c\u6700\u597d\u662f\u4e00\u500b\u7d71\u5408\u5404\u7a2e\u8cc7\u8a0a\u7684\u5de5\u5177\uff0c\u800cgoogle\u5927\u795e\u4e5f\u5728android 4.1 \u4e4b\u5f8c\u63a8\u51fa<\/p>\n<h2><a href=\"http:\/\/developer.android.com\/tools\/debugging\/systrace.html\" target=\"_blank\">\u300eSystrace\u300f<\/a><\/h2>\n<p>\u6b63\u5e38\u904b\u884c\u756b\u9762<br \/>\n<img fetchpriority=\"high\" decoding=\"async\" class=\"\" src=\"http:\/\/developer.android.com\/images\/systrace\/overview.png\" alt=\"systrace\" width=\"763\" height=\"525\" \/><br \/>\n\uff08\u9019\u5716\u7247\u770b\u8d77\u4f86\u5f88\u9b3c\u626f\uff0c\u4f46\u662f\u771f\u7684\u5f88\u9069\u5408\u7528\u4f86\u51fa\u5831\u544a\u7d66\u4e3b\u7ba1\u770b\uff09<\/p>\n<h4>\u76ee\u524d\u4e3b\u8981\u6709\u5169\u7a2e\u65b9\u5f0f\u555f\u52d5\u9019\u795e\u6b66<br \/>\n1. Command Line Usage\uff08<a title=\"http:\/\/developer.android.com\/tools\/help\/systrace.html#options\" href=\"http:\/\/developer.android.com\/tools\/help\/systrace.html#options\" target=\"_blank\">\u5b98\u7db2<\/a>\uff09<br \/>\n<strong>python systrace.py [options] [category1] [category2] &#8230; [categoryN]<\/strong><\/h4>\n<p class=\"note\"><strong>Tip:<\/strong> If you want to see the names of tasks in the trace output, you <em>must<\/em> include the <code>sched<\/code> category in your command parameters.<\/p>\n<p>The table below lists the Systrace command line options for devices running Android 4.3 (API level 18) and higher.<\/p>\n<table>\n<tbody>\n<tr>\n<th>Option<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td><code>-h, --help<\/code><\/td>\n<td>Show the help message.<\/td>\n<\/tr>\n<tr>\n<td><code>-o\u00a0&lt;<em>FILE<\/em>&gt;<\/code><\/td>\n<td>Write the HTML trace report to the specified file.<\/td>\n<\/tr>\n<tr>\n<td><code>-t N, --time=N<\/code><\/td>\n<td>Trace activity for <em>N<\/em> seconds. The default value is 5 seconds.<\/td>\n<\/tr>\n<tr>\n<td><code>-b N, --buf-size=N<\/code><\/td>\n<td>Use a trace buffer size of <em>N<\/em> kilobytes. This option lets you limit the total size of the data collected during a trace.<\/td>\n<\/tr>\n<tr>\n<td><code>-k\u00a0&lt;<em>KFUNCS<\/em>&gt;<br \/>\n--ktrace=&lt;<em>KFUNCS<\/em>&gt;<\/code><\/td>\n<td>Trace the activity of specific kernel functions, specified in a comma-separated list.<\/td>\n<\/tr>\n<tr>\n<td><code>-l, --list-categories<\/code><\/td>\n<td>List the available tracing category tags. The available tags are:<\/p>\n<ul>\n<li><code>gfx<\/code> &#8211; Graphics<\/li>\n<li><code>input<\/code> &#8211; Input<\/li>\n<li><code>view<\/code> &#8211; View<\/li>\n<li><code>webview<\/code> &#8211; WebView<\/li>\n<li><code>wm<\/code> &#8211; Window Manager<\/li>\n<li><code>am<\/code> &#8211; Activity Manager<\/li>\n<li><code>audio<\/code> &#8211; Audio<\/li>\n<li><code>video<\/code> &#8211; Video<\/li>\n<li><code>camera<\/code> &#8211; Camera<\/li>\n<li><code>hal<\/code> &#8211; Hardware Modules<\/li>\n<li><code>res<\/code> &#8211; Resource Loading<\/li>\n<li><code>dalvik<\/code> &#8211; Dalvik VM<\/li>\n<li><code>rs<\/code> &#8211; RenderScript<\/li>\n<li><code>sched<\/code> &#8211; CPU Scheduling<\/li>\n<li><code>freq<\/code> &#8211; CPU Frequency<\/li>\n<li><code>membus<\/code> &#8211; Memory Bus Utilization<\/li>\n<li><code>idle<\/code> &#8211; CPU Idle<\/li>\n<li><code>disk<\/code> &#8211; Disk input and output<\/li>\n<li><code>load<\/code> &#8211; CPU Load<\/li>\n<li><code>sync<\/code> &#8211; Synchronization Manager<\/li>\n<li><code>workq<\/code> &#8211; Kernel Workqueues<\/li>\n<\/ul>\n<p class=\"note\"><strong>Note:<\/strong> Some trace categories are not supported on all devices.<\/p>\n<p class=\"note\"><strong>Tip:<\/strong> If you want to see the names of tasks in the trace output, you <em>must<\/em> include the <code>sched<\/code> category in your command parameters.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><code>-a\u00a0&lt;<em>APP_NAME<\/em>&gt;<br \/>\n--app=&lt;<em>APP_NAME<\/em>&gt;<\/code><\/td>\n<td>Enable tracing for applications, specified as a comma-separated list of <a href=\"http:\/\/developer.android.com\/guide\/topics\/manifest\/manifest-element.html#package\">package names<\/a>. The apps must contain tracing instrumentation calls from the <code><a href=\"http:\/\/developer.android.com\/reference\/android\/os\/Trace.html\">Trace<\/a><\/code>class. For more information, see <a href=\"http:\/\/developer.android.com\/tools\/debugging\/systrace.html#app-trace\">Analyzing UI Performance with Systrace<\/a>.<\/td>\n<\/tr>\n<tr>\n<td><code>--from-file=&lt;<em>FROM_FILE<\/em>&gt;<\/code><\/td>\n<td>Create the interactive Systrace report from a file, instead of running a live trace.<\/td>\n<\/tr>\n<tr>\n<td><code>-e &lt;<em>DEVICE_SERIAL<\/em>&gt;<br \/>\n--serial=&lt;<em>DEVICE_SERIAL<\/em>&gt;<\/code><\/td>\n<td>Conduct the trace on a specific connected device, identified by its <a href=\"http:\/\/developer.android.com\/tools\/help\/adb.html#devicestatus\">device serial number<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u9019\u7a2e\u5b98\u7db2\u5c31\u53ef\u4ee5\u67e5\u5230\u7684\u6771\u897f\uff0c\u6211\u5c31\u4e0d\u591a\u52a0\u4ecb\u7d39\u4e86<br \/>\n2. \u5982\u679c\u6709command \u6050\u61fc\u75c7\u7684\u4eba\u53ef\u4ee5\u8003\u616e\u4f7f\u7528\u5716\u5f62\u754c\u9762\u7248<br \/>\n<a href=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/no_root.png\"><img decoding=\"async\" class=\"alignleft wp-image-66\" src=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/no_root.png\" alt=\"no_root\" width=\"312\" height=\"373\" \/><\/a><a href=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/root.png\"><img decoding=\"async\" class=\"alignleft wp-image-67\" src=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/root.png\" alt=\"root\" width=\"268\" height=\"372\" \/><\/a><\/h4>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u9019\u4e0a\u9762\u5169\u5f35\u5716\u90fd\u662fsystrace\u7684\u9078\u55ae\u754c\u9762\uff0c\u4e26\u4e0d\u662f\u8981\u5927\u5bb6\u73a9\u5927\u5bb6\u4f86\u627e\u78b4<br \/>\n\u800c\u662f\u53ef\u4ee5\u767c\u73fe\u4e0b\u9762\u9019\u4e00\u5f35\u5716\uff0c\u591a\u4e86disk i\/o tag \u00a0\u4ee5\u53ca\u5e95\u4e0b\u8a31\u591akernel \u76f8\u95dc\u7684\u9032\u968e\u9078\u9805<br \/>\n\u9019\u4e3b\u8981\u5dee\u5728 device \u6709\u6c92\u6709root<br \/>\n\u53e6\u5916\u8981\u6ce8\u610f\u7684\u662f systrace \u662f\u5efa\u7acb\u518dlinux \u7684 <a href=\"https:\/\/www.kernel.org\/doc\/Documentation\/trace\/ftrace.txt\" target=\"_blank\">ftrace <\/a>\u6a5f\u5236\uff0c\u6240\u4ee5device\u4e0d\u555f\u7528\u9019\u76f8\u95dcmodule \u7684\u8a71<br \/>\n\u662f\u4e0d\u80fd\u7528\u7684\uff08windows \u4e0d\u80fd\u7528\uff09<\/p>\n<p>\u4ee5\u4e0a\u90fd\u6210\u529f\u5b8c\u6210\u5f8c\uff0c\u53ef\u4ee5\u5f97\u5230\u4e00\u4efd html\u6a94\uff0c\u53ea\u8981\u628a\u4ed6\u7528chrome\u958b\u555f\u5c31\u53ef\u4ee5\u770b\u5230\u5e95\u4e0b\u7684\u5206\u6790\u756b\u9762\u5168tag\u958b\u555f\u6536\u96c6\u4e94\u79d2device\u7684\u756b\u9762\uff0c\u8a2d\u5b9a\u89c0\u6e2capp \u70ba home launcher<\/p>\n<p>vsync , status bar(\u56e0\u70ba\u756b\u9762\u4e0a\u6709) \uff0cbinder \u7b49component<br \/>\n<a href=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/all_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-59\" src=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/all_1.png\" alt=\"all_1\" width=\"1615\" height=\"935\" \/><\/a><\/p>\n<p>dispatcher , surfaceflinger , event control (\u6bcf\u4e00\u500b\u95dc\u9375component\u60f3\u8981\u4e86\u89e3\u7684\u8a71\uff0c\u61c9\u8a72\u53ef\u4ee5\u518d\u8001\u7f85\u7684blog\u627e\u5230)<\/p>\n<p><a href=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/all_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-60\" src=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/all_2.png\" alt=\"all_2\" width=\"1616\" height=\"941\" \/><\/a><\/p>\n<p>allocation , fragment \u914d\u7f6e\uff0c\u4ee5\u53ca android launcher\u7684view\u9031\u671f<\/p>\n<p><a href=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/all_4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-62\" src=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/all_4.png\" alt=\"all_4\" width=\"1605\" height=\"939\" \/><\/a><\/p>\n<p>\u8a2d\u5b9a\u7684\u4e3b\u8981\u89c0\u6e2c\u5c0d\u8c61 android home launcher \u7684 thread , http , \u4ee5\u53caondraw\u4efb\u52d9\u63a8\u5230 render thread \u7684\u8cc7\u8a0a<\/p>\n<h3>Tracing Application Code<\/h3>\n<p>\u9664\u4e86\u5075\u6e2c\u4e3b\u8981\u95dc\u9375\u5143\u4ef6\u7684tag\uff0c\u81ea\u5df1\u4e5f\u53ef\u4ee5\u52a0\u4e00\u4e9btrace\u9ede\u9032\u53bb\uff0c\u5e6b\u52a9\u81ea\u5df1trace code performance.<br \/>\n\u4f46\u662fTrace.beginSection(&#8220;mWriteDiskThreadPool heaton&#8221;) \u548c Trace.endSection()<br \/>\n\u6642\u9593\u9ede\u8981\u6293\u597d\uff08begin,end pair\uff09\uff0c\u4e0d\u7136\u6703\u9577\u9577\u4e00\u689d\uff0c\u4e0d\u6703\u5b8c\u7d50\uff08\u8acb\u5728\u540c\u4e00\u689dthread\u57f7\u884c\uff09<br \/>\nexample.\u5404\u4f4d\u61c9\u8a72\u6709\u767c\u73fe\u4e0a\u9762selected slice \u6709\u4e00\u500b \u00a0mWriteDiskThreadPool heaton \u82b1\u8cbb88.968ms<br \/>\n\u9019\u662f\u6211\u7528\u4f86\u6e2c\u8a66\u81ea\u5df1\u7684write disk time.<\/p>\n<p><a href=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/all_5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-63\" src=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/all_5.png\" alt=\"all_5\" width=\"1616\" height=\"947\" \/><\/a><\/p>\n<h2>\u6848\u4f8b\u5206\u6790<\/h2>\n<h3>CASE 1:<\/h3>\n<p>\u8981\u77e5\u9053\u518d\u958b\u767candroid app\u7684\u904e\u7a0b\u4e2d\uff0c\u6709\u5169\u4ef6\u4ee4\u4eba\u611f\u5230\u6109\u6085\u7684\u4e8b\u60c5<\/p>\n<p>1. \u5c31\u662f\u795e\u4e00\u822c\u7684PM,UI,UX\u60f3\u51fa\u4e00\u500b\u6709\u5982\u795e\u4e00\u822c\u7684UI,\u8907\u96dc\u5230\u4e0d\u53ef\u601d\u8b70\u7684\u795e\u5947view\uff0c\u7136\u5f8c\u5be6\u505a\u7684\u8001\u5144\u5c31\u662f\u4f60<\/p>\n<p>2. \u627f\u4e0a\uff0c\u7136\u5f8c\u7576\u4f60\u82b1\u4e86\u901a\u5929\u7684\u529b\u91cf\u5b8c\u6210\u4e86\u4ee5\u4e0a\u7684view,\u9019\u6642PM\u62ff\u51fa\u4e00\u53f0\u6709\u8005\u721b\u5012\u4e0d\u53ef\u601d\u8b70\u898f\u683c\u7684\u624b\u6a5f<br \/>\n\u7136\u5f8c\u6307\u8005\u90a3\u500bview\u8aaa\uff0c\u9019\u500b\u600e\u67d0\u8dd1\u90a3\u6162\uff0c\u7136\u5f8c\u8981\u4f60fine tune\u3002<\/p>\n<p>\u7b2c\u4e00\u4ef6\u6109\u6085\u7684\u4e8b\u60c5\u5c31\u4e0d\u8ac7\uff0c\u7562\u7adf\u5149\u662f\u505a\u51fa\u4f86\u5c31\u503c\u5f97\u958b\u5fc3\u4e86<br \/>\n\u6240\u4ee5\u8981\u8ac7\u7684\u4e8b\u60c5\u662f\u7b2c\u4e8c\u4ef6\uff0c\u5982\u4f55\u544a\u8a34PM\u9019\u4ef6\u4e8b\u60c5\u8acb\u53bb\u627e\u958b\u51fa\u9019spec\u7684\u4eba<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-64\" src=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/normal.jpg\" alt=\"normal\" width=\"1177\" height=\"656\" \/>\u4e0a\u5716\u662f\u4e00\u822c\u6240\u8b02\u7684smooth\u7684case , draw time should smaller than 16ms<br \/>\n\u5e95\u4e0b\u9019\u662f recycle list view \u7684 scroll \u884c\u70ba\u5206\u6790Systrace.<br \/>\nrender thread \u5f88\u6f02\u4eae\u7684\u6392\u5217\u7dca\u63a5\u5728\u4e00\u8d77\uff0c\u4e14\u6642\u9593\u90fd\u572816ms\u4ee5\u4e0b<\/p>\n<p>\u63a5\u8005\u4f86\u770b\u672c\u6b21\u7684\u6545\u4e8b\uff0c\u540c\u4e00\u652f ap \u4e00\u6a23\u7684\u884c\u70ba\uff0c\u795e\u4e00\u822c\u7684device<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-70\" src=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/unnormal.jpg\" alt=\"unnormal\" width=\"1182\" height=\"555\" \/>\u4e00\u6a23\u5f88\u6574\u9f4a\u7684\u6392\u5217\uff0c\u4f46\u662fdrawframe time \u5f88\u6f02\u4eae\u7684\u5927\u65bc 16 ms \uff0c\u4f86\u5230\u4e8631 ms<br \/>\n\u7576\u7136\u6ed1\u8d77\u4f86\u5361\u5361\u7684\uff0c\u800c\u9019\u6a23\u7684\u60c5\u6cc1\u6211\u5011\u4e5f\u53ea\u80fd\u54c0\u60bc \uff0c\u7136\u5f8c\u8acbpm \u4ed4\u7d30\u60f3\u60f3<br \/>\n\uff0c\u9019\u6a23\u7684\u5361\u9813\u662f application \u5c64\u80fd\u89e3\u6c7a\u7684\u55ce\uff1f<br \/>\n\u901a\u5e38\u6211\u6703\u5efa\u8b70\u8f49\u5230graphic team\u53bbtrace \u70ba\u4f55draw frame \u6253\u9ede\u901f\u5ea6\u6703\u7dad\u6301\u572831ms\uff0c\u4e14\u6392\u5217\u6574\u9f4a<br \/>\n(\u8acb\u642d\u914d UICompThread_0 and VSyncThread_0)<br \/>\n\u9019\u554f\u984c\u4e26\u975e\u572830ms \u5167\u6253\u51fa\u53bb\u6253\u51fa\u53bb\u4e00\u6b2115ms\u7684\u4e00\u5075draw frame\uff0c\u7136\u5f8c\u53e6\u591615ms\u70baidle<br \/>\n\uff08\u96d6\u7136\u9019\u6a23\u4e5f\u5f88\u6709\u554f\u984c\uff0c\u4f46\u662f\u6bd4\u8f03\u5e38\u898b\uff09\uff0c\u800c\u662f\u5b8c\u6574\u768430ms draw frame \u4e00\u5075\uff0c\u63a5\u8005\u89c0\u6e2c\u5176\u4ed6ap\u767c\u73fe\u4e5f\u662f\u9019\u6a23<br \/>\n\u641e\u6210\u9019\u6a23\u7684\u8a71\uff0c\u9019\u6a23\u4e0d\u7ba1\u600e\u67d0\u73a9\uff0c\u5168\u6a5f\u5b50\u90fd\u4e0d\u53ef\u80fd\u9806\u66a2\u7684\uff0c\u56e0\u70ba\u4e00\u500bdraw frame \u88ab\u5b9a\u7fa9\u662f 30ms.<\/p>\n<h3>CASE 2:<\/h3>\n<h3>disk access issue.<\/h3>\n<p><a href=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/systrace_disk_busy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-68\" src=\"https:\/\/boochlin.com\/wp-content\/uploads\/2015\/07\/systrace_disk_busy.png\" alt=\"systrace_disk_busy\" width=\"1610\" height=\"941\" \/><\/a><\/p>\n<p>\u6700\u5f8c\u9762\u7684draw()\u82b1\u8cbb\u6642\u9593\u8db3\u8db3\u8d85\u904e2s\uff0c\u6839\u672c\u5c31\u662f\u6e96\u5099anr\u7684\u7bc0\u594f\uff0c\u4e0d\u904e\u642d\u914ddisk i\/o analyze\u5206\u6790\u5c31\u5f88\u660e\u986f\uff0c\u5728\u90a3draw\u7684\u6642\u5019\u5c45\u7136\u51fa\u73fe1065 \u6b21ext4 write \uff0c\u52a0\u4e0a fdatasync \u4e5f\u8dd1\u4e86160\u6b21\uff0c\u9019\u6a23\u5927\u6982\u53ef\u4ee5\u63a8\u4f30\u662fmultithread\u5728\u9032\u884cdisk i\/o \u9020\u6210cpu \u8cc7\u6e90\u7121\u6cd5\u5b8c\u6574\u7528\u5728main thread ondraw\u4e0a\u3002<br \/>\n\u9019\u500b\u554f\u984c\u53ef\u4ee5\u642d\u914d\u4e4b\u524d\u63d0\u904e\u7684 lsof \u6307\u4ee4\uff0c\u7528\u4f86\u78ba\u5b9a\u5230\u5e95\u662f\u5c0d\u90a3\u500b\u6a94\u6848\u5728\u5b58\u53d6\uff0c\u518d\u914d\u5408\u5229\u7528Tracing Application Code \u7684 trace.beginTraction \u53bb\u8ffd\u8e64\u9019\u6bb5\u6642\u9593\u7684\u90a3\u500bthread \u5b58\u53d6 disk\uff0c\u9032\u800c\u6539\u5584\u7a0b\u5f0f\u3002<\/p>\n<p>\u5b8c\u7d50\uff0c\u8b1d\u8b1d\u6536\u770b<\/p>\n<p>reference:<br \/>\n<a title=\"http:\/\/my.oschina.net\/innost\/blog\/135174\" href=\"http:\/\/my.oschina.net\/innost\/blog\/135174\" target=\"_blank\">http:\/\/my.oschina.net\/innost\/blog\/135174<\/a><br \/>\n<a title=\"http:\/\/www.cnblogs.com\/tianzhijiexian\/p\/4264794.html\" href=\"http:\/\/www.cnblogs.com\/tianzhijiexian\/p\/4264794.html\" target=\"_blank\">http:\/\/www.cnblogs.com\/tianzhijiexian\/p\/4264794.html<\/a><\/p>\n<p><a title=\"http:\/\/developer.android.com\/tools\/help\/systrace.html\" href=\"http:\/\/developer.android.com\/tools\/help\/systrace.html\" target=\"_blank\">http:\/\/developer.android.com\/tools\/help\/systrace.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f60\u8eab\u70baanddroid \u5de5\u7a0b\u5e2b\u7684\u751f\u6daf\u4e2d\uff0c\u4e00\u5b9a\u66fe\u7d93\u6709\u4eba\u6703\u62ff\u8005\u624b\u6a5f\uff0c\u908a\u6ed1\u908a\u544a\u8a34\u4f60\uff0c\u9019\u500b\u600e\u67d0\u770b\u8d77\u4f86\u597d\u5361 \u7136\u5f8c\u8acb\u4f60\u4fee\u597d\u3002 \u300e\u597d\u5361\u300f\u4e00\u500b\u5f88\u4e3b\u89c0\u7684\u6558\u8ff0\uff0c\u7562\u7adf\u5361\u7684\u5b9a\u7fa9\u5927\u5bb6\u90fd\u4e0d\u4e00\u6a23\uff0c\u4f46\u662f\u5176\u5be6\u9019\u6709\u5f88\u8a73\u7d30\u7684\u5b9a\u7fa9 \u300e y&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50,5],"tags":[6,48,9,11],"_links":{"self":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/51"}],"collection":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=51"}],"version-history":[{"count":0,"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/51\/revisions"}],"wp:attachment":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}