Skip to content

Instantly share code, notes, and snippets.

@yuchen
Forked from andboson/xhprof
Created November 3, 2015 06:37
Show Gist options
  • Save yuchen/2b5f1cdf9e851387af2e to your computer and use it in GitHub Desktop.
Save yuchen/2b5f1cdf9e851387af2e 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
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