facebook twitter hatena line email

「Php/速度改善/tideways xhprof」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(サンプル)
 
(同じ利用者による、間の1版が非表示)
行25: 行25:
  
 
$data = xhprof_disable();
 
$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) } }
+
var_dump($data);
 
</pre>
 
</pre>
 +
 +
出力
 +
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) } }

2026年4月17日 (金) 04:32時点における最新版

インストール(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

サンプル

<?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) } }