Created
November 18, 2016 11:25
-
-
Save pj-dave/c258e755722c16c4ff982cb1bb2382c7 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 | |
/** XHProf configuration */ | |
if ( isset( $_REQUEST['pressjitsu-profile'] ) && $_REQUEST['pressjitsu-profile'] == 'enable' ) { | |
xhprof_enable( XHPROF_FLAGS_MEMORY | XHPROF_FLAGS_CPU ); | |
ob_start(); | |
register_shutdown_function( function() { | |
ob_end_clean(); | |
header( 'Content-type: application/octet-stream' ); | |
header( sprintf( 'Content-Disposition: attachment; filename="%d.perf.xhprof"', time() ) ); | |
echo serialize( xhprof_disable() ); | |
exit; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment