久久久精品一区ed2k-女人被男人叉到高潮的视频-中文字幕乱码一区久久麻豆樱花-俄罗斯熟妇真实视频

tideways+toolkit對php代碼進(jìn)行性能分析的案例-創(chuàng)新互聯(lián)

小編給大家分享一下tideways+toolkit對php代碼進(jìn)行性能分析的案例,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

創(chuàng)新互聯(lián)公司主要從事網(wǎng)站設(shè)計、成都網(wǎng)站制作、網(wǎng)頁設(shè)計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)金平,10年網(wǎng)站建設(shè)經(jīng)驗,價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18980820575

toolkit是tideway官方提供的性能分析的命令行工具。如果你只是本地開發(fā)調(diào)試接口性能,不想安裝xhgui,那么使用toolkit就足夠了.

安裝

安裝tideways拓展

git clone https://github.com/tideways/php-xhprof-extension.git
cd php-profiler-extension
phpize
./configure
make && make install

在php.ini中加入

extension=tideways_xhprof.so

重啟php-fpm

service php-fpm restart

toolkit安裝

go get github.com/tideways/toolkit
# 安裝graphviz
# macOS
brew install graphviz
# ubuntu
sudo apt-get install -y graphviz

設(shè)置別名

alias tk=toolkit

tideways+toolkit

代碼埋點(diǎn)

在程序入口中加入

if (extension_loaded('tideways_xhprof')) {
    tideways_xhprof_enable(TIDEWAYS_XHPROF_FLAGS_CPU | TIDEWAYS_XHPROF_FLAGS_MEMORY);
}
// 你的代碼
application();
if (extension_loaded('tideways_xhprof')) {
    $data = tideways_xhprof_disable();
    file_put_contents(
        sprintf('%s/app.xhprof', '/path/to'),
        json_encode($data)
    );
}

執(zhí)行下代碼,然后就會生成/path/to/app.xphrof

性能分析

tk analyze-xhprof /path/to/app.xphrof

tideways+toolkit對php代碼進(jìn)行性能分析的案例

默認(rèn)性能分析的指標(biāo)是wt_excl,其他的指標(biāo)有

1.wt 調(diào)用時長,包括子函數(shù)

2.excl_wt 調(diào)用時長,不包括子函數(shù)

3.cpu CPU調(diào)用時長,包括子函數(shù)

4.excl_cpu CPU調(diào)用時長,不包括子函數(shù)

5.memory 內(nèi)存消耗(字節(jié)),包括子函數(shù)

6.excl_memory 內(nèi)存消耗(字節(jié)),不包括子函數(shù)

7.io io時長,包括子函數(shù)

8.excl_io io時長,不包括子函數(shù)

生成性能瓶頸圖

tk generate-xhprof-graphviz /path/to/app.xhprof
dot -Tpng callgraph.dot > callgraph.png

tideways+toolkit對php代碼進(jìn)行性能分析的案例

顯示的指標(biāo)有

1.函數(shù)名

2.Inc 函數(shù)運(yùn)行時間,包括子函數(shù)

3.Excl 函數(shù)運(yùn)行時間,不包括子函數(shù)

4.total calls 總調(diào)用次數(shù)

以上是tideways+toolkit對php代碼進(jìn)行性能分析的案例的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

網(wǎng)頁標(biāo)題:tideways+toolkit對php代碼進(jìn)行性能分析的案例-創(chuàng)新互聯(lián)
標(biāo)題URL:http://sd-ha.com/article36/podsg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、域名注冊、關(guān)鍵詞優(yōu)化、自適應(yīng)網(wǎng)站微信小程序、小程序開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化