Select a cachegrind file above
就是这样了。
Webgrind是一个解析和查看名为cachegrind的性能分析文件格式的工具。PHP扩展程序Xdebug可以(除其他非常有用的功能外)生成这种格式的文件。要使用webgrind,需要安装并启用Xdebug。
Google Code上的Wiki提供了更多关于配置webgrind的信息。
1) 从官网下载XDebug。
2) 将所有DLL文件放入PHP扩展目录:C:\wamp\bin\php\php5.x.x\ext
3) 在位于C:\wamp\bin\php\php5.x.x
的php.ini
文件中添加以下行:
zend_extension = c:\wamp\bin\php\php5.3.0\ext\php_xdebug-2.1.0-5.3-vc6.dll
4) 还需要在您的php.ini文件中添加以下内容(首先搜索[xdebug]部分以确保其尚不存在):
[xdebug]
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "c:\wamp\www\webgrind\tmp"
xdebug.profiler_output_name = cachegrind.out.%t.%p
5)重启Wamp并验证已加载扩展程序。为此,在C:\ wamp \ www \
中添加一个文件pi.php
,并将以下代码放入其中:
<?php
phpinfo();
?>
6) 打开浏览器,访问 http://localhost/pi.php
并查找 XDebug 以检查输出结果。
7) 从下载页面下载 Webgrind 并将其解压缩到您的 www
文件夹中。
8) 编辑位于 C:\wamp\www\webgrind\
的 config.php
文件以更改存储目录:
static $storageDir = 'c:\wamp\www\webgrind\tmp';
static $profilerDir = 'c:\wamp\www\webgrind\tmp';
9) 在您提取代码的Webgrind目录中添加一个.htaccess
文件,并将以下内容放入其中,以避免Webgrind对自身进行分析:
9)在您提取代码的Webgrind目录中添加一个.htaccess
文件,并将以下内容放入其中,以避免Webgrind对自身进行分析:
php_flag xdebug.profiler_enable 0
10) 重新运行 http://localhost/pi.php
脚本生成一些分析数据。
11) 使用 http://localhost/webgrind
打开您的浏览器以显示结果。不要忘记点击 Update
按钮!
本答案基于 Jacob Moen 提供的答案。您可以在这里查看原始来源。
;-)
- Synetech更新PHP.INI文件,添加以下参数:
重新启动所有服务。
这样就可以了。
你不需要做太多的事情...
我只是编辑了这一行:
xdebug.profiler_enable = 1
就这样,伙计。完全可行!
php_flag error_reporting E_NONE
,然后一切正常! - userfuser