PHP性能分析工具xdebug+qcachegrind

先安装xdebug工具 pecl install xdebug 修改php.ini配置 [xdebug] zend_extension="xdebug.so" # profiler功能的开关,默认值0,如果设为1,则每次请求都会生成一个性能报告文件。 # xdebug.profiler_enable=0 # 默认值是0,如果设为1 则当我们的请求中包含 XDEBUG_PROFILE 参数时才会生成性能报告文件 xdebug.profiler_enable_trigger=1 # 分析文件保存目录, 默认是 /var/tmp xdebug.profiler_output_dir="/var/tmp/xdebug" 请求参数加上XDEBUG_PROFILE才会生成分析文件, 会生成在这里 /var/tmp/xdebug http://127.0.0.1/phpinfo.php?XDEBUG_PROFILE 安装qcachegrind brew install qcachegrind --with-graphviz 在命令行里使用 qcachegrind 打开它,然后通过它打开要分析的文件 也可以在命令后直接跟要分析的文 qcachegrind /var/tmp/xdebug/cachegrind.out.38595 参考: http://yzone.net/blog/151 https://stackoverflow.com/questions/4473185/do-you-have-kcachegrind-like-profiling-tools-for-mac http://stackoverflow.org.cn/front/ask/view?ask_id=340042

猜你喜欢

转载自www.cnblogs.com/derrck/p/9150412.html