Skip to content

Instantly share code, notes, and snippets.

@andboson
Created February 3, 2015 15:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save andboson/dba379dd879f387ee1fa to your computer and use it in GitHub Desktop.
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
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>";
});
@efinal
Copy link

efinal commented Jul 31, 2015

3x

@andboson
Copy link
Author

andboson commented Sep 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment