{"id":15,"date":"2017-12-09T21:43:37","date_gmt":"2017-12-09T13:43:37","guid":{"rendered":"https:\/\/blog.simbot.net\/?p=15"},"modified":"2018-03-11T15:09:35","modified_gmt":"2018-03-11T07:09:35","slug":"apitrace","status":"publish","type":"post","link":"https:\/\/blog.simbot.net\/2017\/12\/09\/apitrace\/","title":{"rendered":"\u4f7f\u7528apitrace\u5206\u6790OpenGL\u7a0b\u5e8f\u6027\u80fd"},"content":{"rendered":"

\u4f7f\u7528apitrace\u5206\u6790OpenGL\u7a0b\u5e8f\u6027\u80fd<\/h1>\n

\u4f5c\u8005\uff1ahws000\uff08hws.000#163.com\uff09
\n\u58f0\u660e\uff1a\u7248\u6743\u6240\u6709\uff0c\u8f6c\u8f7d\u8bf7\u8054\u7cfb\u4f5c\u8005\u3002
\n\u51fa\u5904\uff1ahttps:\/\/blog.simbot.net\/index.php\/2017\/12\/09\/apitrace\/<\/a><\/p>\n

apitrace\u652f\u6301Linux\u3001OS X\u3001Windows\u7cfb\u7edf\uff0c\u53ef\u4ee5\u5206\u6790OpenGL\u3001Direct3D API\uff0c\u672c\u6587\u4e3b\u8981\u5728Linux\u4e0b\u5b8c\u6210\uff0c\u5206\u6790\u76ee\u6807\u662fchrome\u6d4f\u89c8\u5668\u3002<\/p>\n

\u5b98\u7f51\uff1ahttp:\/\/apitrace.github.io\/<\/a>\u3002\u5728\u5b98\u7f51\u6700\u4e0b\u8fb9\u5217\u4e86\u597d\u591a\u6027\u80fd\u5206\u6790\u5de5\u5177\uff0c\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u628a\u8fd9\u4e9b\u90fd\u7528\u4e00\u4e0b\uff0c\u5404\u6709\u7279\u8272\u3002\u5176\u5b9e\u6700\u5f00\u59cb\u505a\u6027\u80fd\u5206\u6790\u7684\u65f6\u5019\u7528\u7684\u662fIntel\u7684Graphics Performance Analyzers\uff0c\u4f46GPA\u53ea\u80fd\u7528\u5728Intel\u7684\u663e\u5361\u4e0a\uff0c\u5e76\u4e14\u8c8c\u4f3c\u4e0d\u80fd\u5206\u6790chrome\u3002
\n\u5b98\u65b9\u4f7f\u7528\u8bf4\u660e\uff1a
https:\/\/github.com\/apitrace\/apitrace\/blob\/master\/docs\/USAGE.markdown<\/a><\/p>\n

1.\u7528\u6765\u5206\u6790chrome\u7684\u547d\u4ee4\u884c\u53c2\u6570<\/h2>\n

apitrace trace –api gl \/usr\/lib\/chromium-browser\/chromium-browser –ignore-gpu-blacklist –single-process http:\/\/127.0.0.1\/Cesium-1.36\/Apps\/Sandcastle\/gallery\/Hello%20World.html<\/p>\n

2.\u5c06\u7ed3\u679c\u91cd\u73b0\u5e76\u8f93\u51fa\u5230chromium-browser.retrace\u6587\u4ef6\u7684\u547d\u4ee4<\/h2>\n

apitrace replay –pgpu –pcpu –ppd chromium-browser.trace > chromium-browser.retrace
\n\u5305\u542b\u5982\u4e0b\u4fe1\u606f\uff1a
\n# call no gpu_start gpu_dura cpu_start cpu_dura vsize_start vsize_dura rss_start rss_dura pixels program name
\n\u53ea\u770b\u7279\u5b9a\u5173\u952e\u51fd\u6570\u7684\u547d\u4ee4\uff1a
\ngrep -E ‘glDrawElements|frame_end|glClear$|glBlitFramebuffer’ chromium-browser.retrace > 1.txt<\/p>\n

3.\u6bd4replay\u66f4\u5f3a\u5927\u6613\u7528\u7684\u5de5\u5177qapitrace<\/h2>\n

\u542f\u52a8\u547d\u4ee4\uff1aqapitrace chromium-browser.trace
\n\"\"
\n\u53ef\u4ee5\u6309\u5e27\u663e\u793a\u6bcf\u5e27\u7684\u4fe1\u606f\uff0c\u53cc\u51fb\u67d0\u4e2a\u51fd\u6570\u53ef\u4ee5\u5728\u53f3\u4fa7\u663e\u793a\u8c03\u7528\u65f6\u7684\u72b6\u6001\u3002
\n\"\"
\n\u9009\u4e2d\u5de5\u5177\u680fTrace\u4e0b\u7684Profile\u529f\u80fd\uff0c\u4f1a\u6267\u884c\u4e0ereplay\u76f8\u540c\u7684\u52a8\u4f5c\uff0c\u5e76\u5c06\u7ed3\u679c\u66f4\u76f4\u89c2\u7684\u5c55\u793a\u51fa\u6765\u3002
\n\"\"
\n\u754c\u9762\u4ece\u4e0a\u5230\u4e0b\u4f9d\u6b21\u4e3a\uff1aFrames\uff0c\u5e27\u53f7\uff1bCPU\uff0c\u5904\u7406\u5668\u7aef\u7684\u6267\u884c\u987a\u5e8f\u548c\u65f6\u957f\uff08\u7528\u5bbd\u5ea6\u8868\u793a\uff09\uff1bGPU\uff0c\u663e\u5361draw\u51fd\u6570\u7684\u6267\u884c\u987a\u5e8f\u548c\u65f6\u957f\uff1b\u7f16\u53f7n\uff0c\u7b2cn\u4e2ashader\u7684\u6267\u884c\u60c5\u51b5\uff1bGPU\u3001CPU\u7684\u6267\u884c\u65f6\u957f\uff08\u9ad8\u5ea6\uff09\uff1bProgram\uff0cshader\u7684\u6267\u884c\u60c5\u51b5\u3002
\n\u5c06\u9f20\u6807\u653e\u5230\u67d0\u4e2a\u51fd\u6570\u4e0a\u4f1a\u51fa\u73b0\u63d0\u793a\u4fe1\u606f\uff0c\u53cc\u51fb\u4f1a\u5728\u4e3b\u7a97\u53e3\u4e2d\u663e\u793a\u5f53\u524d\u51fd\u6570\u3002<\/p>\n

4.\u603b\u7ed3<\/h2>\n

\u7528apitrace\u505a\u6027\u80fd\u5206\u6790\u65f6\uff0c\u4f1a\u5c06\u6240\u6709\u6570\u636e\u4fdd\u5b58\u5230\u8bb0\u5f55\u6587\u4ef6\uff0creplay\u65f6\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\u548c\u51fd\u6570\u53c2\u6570\uff0c\u91cd\u65b0\u6267\u884c\u7ed8\u5236\u8fc7\u7a0b\u5e76\u8bb0\u5f55CPU\u3001GPU\u7684\u65f6\u6233\u3002\u7531\u4e8ereplay\u662f\u76f4\u63a5\u4ece\u8bb0\u5f55\u6587\u4ef6\u8bfb\u53d6\u6570\u636e\uff0c\u7f3a\u5c11CPU\u7aef\u7684\u771f\u6b63\u7684\u6267\u884c\u8fc7\u7a0b\uff0c\u6240\u4ee5\u65f6\u6233\u5e76\u4e0d\u51c6\u786e\uff0c\u4f46GPU\u7684\u8017\u65f6\u8ba1\u7b97\u662f\u6b63\u786e\u7684\u3002\u672c\u6587\u7684\u622a\u56fe\u662f\u7528\u7684\u6539\u8fdb\u8fc7\u7684\u7a0b\u5e8f\uff0c\u65f6\u6233\u5df2\u7ecf\u6b63\u786e\uff08\u6240\u4ee5\u80fd\u770b\u5230\u5e27\u95f4\u7684\u7a7a\u767d\u671f\uff09\uff0cqapitrace\u4e3b\u754c\u9762\u4e5f\u7a0d\u5fae\u505a\u4e86\u4e00\u70b9\u6539\u52a8\u3002\u7a0b\u5e8f\u7684\u8be6\u7ec6\u5206\u6790\u548c\u4fee\u6539\u4f1a\u5728\u4e0b\u4e00\u7bc7\u6587\u7ae0\u4e2d\u4ecb\u7ecd\u3002<\/p>\n

\u672c\u6587\u8865\u7684\u662f\u524d\u51e0\u4e2a\u6708\u7684\u6210\u679c\uff0c\u91cd\u65b0\u6267\u884cchrome\u8fdb\u884c\u5206\u6790\u7684\u65f6\u5019\u53d1\u73b0\u4e0d\u80fd\u6b63\u5e38\u542f\u52a8\uff0c\u6b64\u65f6chrome\u5e76\u672a\u5355\u8fdb\u7a0b\u8fd0\u884c\uff0c\u5c06\u63d2\u4ef6\u529f\u80fd\u7981\u7528\u95ee\u9898\u89e3\u51b3\u3002\u3002\u3002\u5dee\u70b9\u8981\u80cc\u4e00\u4e2a\u95ed\u7740\u773c\u5199\u6587\u7ae0\u7684\u9505\u3002\u3002\u3002\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

apitrace\u652f\u6301Linux\u3001OS X\u3001Windows\u7cfb\u7edf\uff0c\u53ef\u4ee5\u5206\u6790OpenGL\u3001Direct3D API\uff0c\u672c\u6587\u4e3b\u8981\u5728Linux\u4e0b\u5b8c\u6210\uff0c\u5206\u6790\u76ee\u6807\u662fchrome\u6d4f\u89c8\u5668\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[5,10,8,18],"_links":{"self":[{"href":"https:\/\/blog.simbot.net\/wp-json\/wp\/v2\/posts\/15"}],"collection":[{"href":"https:\/\/blog.simbot.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.simbot.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.simbot.net\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.simbot.net\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":8,"href":"https:\/\/blog.simbot.net\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"predecessor-version":[{"id":30,"href":"https:\/\/blog.simbot.net\/wp-json\/wp\/v2\/posts\/15\/revisions\/30"}],"wp:attachment":[{"href":"https:\/\/blog.simbot.net\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.simbot.net\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.simbot.net\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}