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

  • 相关阅读:
    WeakReference(弱引用)
    男人怎么挑选女人
    同步方法和异步方法
    常指针与指针常量的区别(转帖)
    关于WebService的一些注意事项
    ASP.Net缓存技术
    关于GridView手动绑定的一段代码,一切尽在不言中
    基本三层架构的一些代码
    写给自己看的关于DataList的和RePeater
    ASP.Net绑定数据源
  • 原文地址:https://www.cnblogs.com/buexplain/p/4821619.html
Copyright © 2011-2022 走看看