<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                [TOC] ### 1. 下載xhprof源碼并安裝 > https://github.com/longxinH/xhprof.git ``` cd xhprof/extension/ phpize ./configure --with-php-config=/www/server/php/71/bin/php-config --enable-xhprof make && make install ``` > 修改php.ini配置 ``` [xhprof] extension = xhprof.so xhprof.output_dir = /tmp/xhprof ``` ### 2. Yii2集成xhprof > 將xhprof下的xhprof_html以及xhprof_lib拷貝至項目中 ~~~ public function actionTest1() { error_reporting(E_ALL); ini_set('display_errors', 'on'); $this->xhprofStart(); for ($i = 0; $i < 83000; $i++) { $array[] = $i; } $this->haha(); $this->xhprofEnd(); } public function haha(){ echo 'haha'; } //xhprof監控開始 public function xhprofStart(){ xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); } //xhprof監控結束 public function xhprofEnd(){ $xhprof_data = xhprof_disable(); dump($xhprof_data); $xhprof_root = '/www/wwwroot/liwu4/frontend/web/'; include_once $xhprof_root."xhprof_lib/utils/xhprof_lib.php"; include_once $xhprof_root."xhprof_lib/utils/xhprof_runs.php"; $xhprof_runs = new \XHProfRuns_Default(); $route = \Yii::$app->controller->route; $run_id = $xhprof_runs->save_run($xhprof_data, $route); echo '統計<br>'; $domain = $_SERVER['SERVER_NAME']; $url = "http://".$domain."/xhprof_html/index.php?run=$run_id&source=$route"; echo '<a target="_blank">'.$url.'</a>'; } ~~~ > 在運行的時候,可能會沒有監控數據,報Invalid Run Id的錯誤 > 解決辦法 ``` chmod -R 777 /tmp/xhprof ``` > 修改xhprof_lib/utils/xhprof_runs.php中找到save_run()方法 ~~~ $file_name = $this->file_name($run_id, $type); // 找到此代碼,新增以下代碼 // 增加以下創建文件夾的代碼,才能生成報表數據 $dir = dirname($file_name); if (!is_dir($dir)) { mkdir($dir, 0777, true); } ~~~ ### 3. 運行并測試 > http://www.xx.com/wangkun/test1 ![](https://img.kancloud.cn/83/38/8338047e814ae3f073a56ce44461e16c_962x546.png) > 由于xhprof屬于非侵入性,可以運用到正式環境,常用URL中加入code方式,輸入正確的code情況下走xhprof > xdebug屬于侵入式性能分析,安裝好了php插件后,頁面就自動開啟,只能運用在測試環境 > 參考此文 https://blog.csdn.net/maquealone/article/details/80434699 ### 4. 圖形化結果 > 點擊[View Full Callgraph]可以看圖形化結果,會報錯“failed to execute cmd " dot -Tpng"” > 解決辦法 ~~~ yum install graphviz ~~~ > 安裝完擴展后,需要修改php.ini,在disable_functions中把proc_open去掉。 ![](https://img.kancloud.cn/3b/c6/3bc66d56babc002d5ed3da720de148f7_1797x543.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看