windows下安装php性能分析工具XHProf

一、安装扩展

下载XHProf扩展:http://dev.freshsite.pl/php-extensions/xhprof.html

放入扩展文件:下载后解压出.dll文件,拷贝它到php的ext文件夹里面。

开启扩展:php.ini中加入下面的代码

[xhprof]
extension=xhprof.dll
xhprof.output_dir="F:/xhprof/xhprof_log"

二、安装php分析包

这个扩展需要一个php程序来调用。

百度网盘下载:http://pan.baidu.com/s/1pJtck7D

官网下载:pecl.php.net/package/xhprof

下载完毕后解压到 F:/xhprof/xhprof-0.9.4

文件 F:\xhprof\xhprof-0.9.4\examples\sample.php 里面有个基本的例子

// start profiling
xhprof_enable();
//这里是你要分析的代码
/ stop profiler
$xhprof_data = xhprof_disable();
include_once "F:/xhprof/xhprof-0.9.4/xhprof_lib/utils/xhprof_lib.php";
include_once "F:/xhprof/xhprof-0.9.4/xhprof_lib/utils/xhprof_runs.php";
// save raw data for this profiler run using default
// implementation of iXHProfRuns.
$xhprof_runs = new XHProfRuns_Default();
// save the run under a namespace "xhprof_foo"
$run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_yii"); //导出性能日志 到你安装扩展时候指定的文件夹里面

然后访问你需要分析的代码就可以得到一个日志文件。F:\xhprof\xhprof_log\55fd13b01475f.xhprof_yii.xhprof

三、查看生成的日志

配置一个域名,根目录到 F:\xhprof\xhprof-0.9.4\xhprof_html。

访问域名即可查看刚才生成的日志文件。

资源下载:

xhprof

http://pecl.php.net/package/xhprof
http://mirror.facebook.net/facebook/xhprof/doc.html
https://github.com/facebook/xhprof

 

转载于:https://www.cnblogs.com/buexplain/p/4821619.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值