Last active
August 29, 2015 13:56
-
-
Save Yanovskiy/9048355 to your computer and use it in GitHub Desktop.
XHProf enable
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 | |
if(extension_loaded('xhprof')) { | |
$utilsPath = '/usr/share/php5-xhprof/xhprof_lib/utils/'; | |
include_once $utilsPath . 'xhprof_lib.php'; | |
include_once $utilsPath . 'xhprof_runs.php'; | |
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); | |
register_shutdown_function(function() { | |
$profilerNamespace = pathinfo(__FILE__, PATHINFO_FILENAME); | |
$data = xhprof_disable(); | |
$xhprofRuns = new XHProfRuns_Default(); | |
$xhprofRuns->save_run($data, $profilerNamespace); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment