zoukankan      html  css  js  c++  java
  • 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:xhprofxhprof-0.9.4examplessample.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:xhprofxhprof_log55fd13b01475f.xhprof_yii.xhprof

    三、查看生成的日志

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

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

    资源下载:

    xhprof

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

  • 相关阅读:
    辗转相除法求最大公约数
    洛谷——P2615 神奇的幻方 【Noip2015 day1t1】
    二分图的一大泼基础题
    HDU——T 1150 Machine Schedule
    HDU——T 1068 Girls and Boys
    POJ——T 3020 Antenna Placement
    Web框架Django(二)
    February 25 2017 Week 8 Saturday
    February 24 2017 Week 8 Friday
    February 23 2017 Week 8 Thursday
  • 原文地址:https://www.cnblogs.com/buexplain/p/4821619.html
Copyright © 2011-2022 走看看