{"id":6738,"date":"2022-02-03T20:22:44","date_gmt":"2022-02-03T20:22:44","guid":{"rendered":"https:\/\/blog.gwlin.com\/?p=6738"},"modified":"2023-04-01T23:28:11","modified_gmt":"2023-04-01T15:28:11","slug":"php-cli-%e4%b8%8b-%e8%bf%9b%e8%a1%8c-xdebug-profiling-%e6%80%a7%e8%83%bd%e7%93%b6%e9%a2%88%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/www.gwlin.com\/blog\/posts\/6738","title":{"rendered":"php cli \u4e0b \u8fdb\u884c xdebug profiling \u6027\u80fd\u74f6\u9888\u5206\u6790"},"content":{"rendered":"\n<p>\u5199\u7684\u4e00\u4e2aphp\u811a\u672c\u8dd1\u7684\u5f88\u6162\uff0c\u60f3\u5230\u53ef\u4ee5\u7528xdebug\u8fdb\u884c\u6027\u80fd\u5206\u6790\u3002\u4f46\u5e73\u65f6\u90fd\u662f\u5728http\u8bf7\u6c42\u6a21\u5f0f\u4e0b\u7528\u7684\uff0c\u5728cli\u4e0b\u4f7f\u7528\u7684\u573a\u666f\u4e0d\u591a\u3002<\/p>\n\n\n\n<p>\u641c\u4e86\u4e00\u4e0b\uff0c\u5728cli\u4e0b\u66f4\u52a0\u7b80\u5355\u3002\u4ee5xdebug3\u4e3a\u4f8b\uff08\u6ce8\u610f\u81ea\u5df1\u7684xdebug\u7248\u672c\uff0c\u53c2\u6570\u540d\u79f0\u4e0d\u4e00\u6837\u7684\uff0c\u53ef\u4ee5\u81ea\u5df1\u67e5\u67e5xdebug\u7684\u914d\u7f6e\u6587\u4ef6\u3002\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >php -d xdebug.mode=profile -d xdebug.output_dir=. script.php<\/code><\/pre>\n\n\n\n<p>\u5728linux\u4e0b\u9762\u53ef\u4ee5\u628a\u4e0a\u9762\u7684\u53c2\u6570\u5199\u6210 aliases \uff0c\u65b9\u4fbf\u4ee5\u540e\u4f7f\u7528\u3002<\/p>\n\n\n\n<p>\u547d\u4ee4\u8fd0\u884c\u5b8c\u540e\uff0c\u4f1a\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u751f\u6210.out\u6587\u4ef6\uff0c\u53ef\u4ee5\u7528 phpstorm \u91cc\u7684 \u5de5\u5177\u8fdb\u884c\u5206\u6790\uff08\u5de5\u5177\u680f\u91cc\u7684 analyze xdebug profiler snapshot\uff09\u3002\u6ca1\u6709phpstorm\u7684\u8bdd\u4e5f\u53ef\u4ee5\u770b\u770b\u5176\u4ed6\u5de5\u5177\uff0c\u50cf<span style=\"font-size: 14px;\">KCachegrind<\/span><span style=\"font-size: 14px;\">&nbsp;\u4e4b\u7c7b\u7684\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>php -d xdebug.mode=profile -d xdebug.output_dir=. script.php<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[179],"tags":[],"class_list":["post-6738","post","type-post","status-publish","format-standard","hentry","category-notes"],"_links":{"self":[{"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/posts\/6738","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/comments?post=6738"}],"version-history":[{"count":1,"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/posts\/6738\/revisions"}],"predecessor-version":[{"id":42913,"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/posts\/6738\/revisions\/42913"}],"wp:attachment":[{"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/media?parent=6738"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/categories?post=6738"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gwlin.com\/blog\/wp-json\/wp\/v2\/tags?post=6738"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}