「Php/速度改善/tideways xhprof」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==インストール(php8の場合)== <pre> dnf install -y php-devel php-pear gcc make pecl install tideways_xhprof </pre> ===php.ini設定== <pre> echo "extension=xhpro...」) |
|||
| 行5: | 行5: | ||
</pre> | </pre> | ||
| − | ===php.ini設定== | + | ===php.ini設定=== |
<pre> | <pre> | ||
echo "extension=xhprof.so" > /etc/php.d/50-xhprof.ini | echo "extension=xhprof.so" > /etc/php.d/50-xhprof.ini | ||
| 行15: | 行15: | ||
xhprof | xhprof | ||
</pre> | </pre> | ||
| + | |||
| + | ==サンプル== | ||
| + | </pre> | ||
| + | <?php | ||
| + | xhprof_enable(); | ||
| + | |||
| + | // 適当な処理 | ||
| + | usleep(100000); | ||
| + | |||
| + | $data = xhprof_disable(); | ||
| + | var_dump($data); // array(3) { ["main()==>usleep"]=> array(2) { ["ct"]=> int(1) ["wt"]=> int(100109) } ["main()==>xhprof_disable"]=> array(2) { ["ct"]=> int(1) ["wt"]=> int(0) } ["main()"]=> array(2) { ["ct"]=> int(1) ["wt"]=> int(100125) } } | ||
| + | <pre> | ||
2026年4月17日 (金) 04:31時点における版
インストール(php8の場合)
dnf install -y php-devel php-pear gcc make pecl install tideways_xhprof
php.ini設定
echo "extension=xhprof.so" > /etc/php.d/50-xhprof.ini
確認
$ php -m | grep xhprof xhprof
サンプル
</pre> <?php xhprof_enable();
// 適当な処理 usleep(100000);
$data = xhprof_disable(); var_dump($data); // array(3) { ["main()==>usleep"]=> array(2) { ["ct"]=> int(1) ["wt"]=> int(100109) } ["main()==>xhprof_disable"]=> array(2) { ["ct"]=> int(1) ["wt"]=> int(0) } ["main()"]=> array(2) { ["ct"]=> int(1) ["wt"]=> int(100125) } }
