Created
February 3, 2015 15:38
-
-
Save andboson/dba379dd879f387ee1fa to your computer and use it in GitHub Desktop.
laravel xhprof snip
wget http://pecl.php.net/get/xhprof-0.9.4.tgz
tar xvf xhprof-0.9.4.tgz
php -S localhost:9999
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define("XHPROF_ROOT", '/var/www/xhprof-0.9.4'); | |
App::before(function(){ | |
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); | |
}); | |
App::after(function(){ | |
require_once (XHPROF_ROOT . '/xhprof_lib/utils/xhprof_lib.php'); | |
require_once (XHPROF_ROOT . '/xhprof_lib/utils/xhprof_runs.php'); | |
$xhprof_data = xhprof_disable(); | |
$xhprof_runs = new XHProfRuns_Default(); | |
$run_id = $xhprof_runs->save_run($xhprof_data, "test"); | |
echo "<a href=\"http://localhost:9999/index.php?run={$run_id}&source=test\">http://localhost/xhprof/xhprof_html/index.php?run={$run_id}&source=test\n</a>"; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
3x