Created
September 17, 2010 21:03
-
-
Save shupp/584952 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
// Example check at the top of your application for enabling profiling | |
if (isset($_SERVER['WWW_PROFILE']) && extension_loaded('xhprof')) { | |
$xproflib = APPLICATION_PATH . '/../public/build/xhprof/xhprof_lib'; | |
include_once $xproflib . '/utils/xhprof_lib.php'; | |
include_once $xproflib . '/utils/xhprof_runs.php'; | |
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); | |
function stop_xhprof_profiling() | |
{ | |
$xhprofData = xhprof_disable(); | |
$xhprofNameSpace = $_SERVER['SERVER_NAME']; | |
$xhprofRuns = new XHProfRuns_Default(); | |
$xhprofRunID = $xhprofRuns->save_run($xhprofData, $xhprofNameSpace); | |
} | |
register_shutdown_function('stop_xhprof_profiling'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment