Created
June 25, 2014 09:51
-
-
Save kovshenin/5f621795e7c67a751929 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_ROOT = '/home/kovshenin/xhprof'; | |
include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php"; | |
include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php"; | |
add_action( 'init', function() { | |
// Make sure it's in cache before we profile. | |
$post = get_post( $post_id ); | |
$post_id = 1134; | |
xhprof_enable(); | |
for ( $i = 0; $i < 1000; $i++ ) { | |
profile_get_permalink_with_obj( $post_id ); | |
profile_get_permalink_with_id( $post_id ); | |
} | |
$xhprof_data = xhprof_disable(); | |
$xhprof_runs = new XHProfRuns_Default(); | |
$run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_foo"); | |
?> | |
<iframe src="<?php echo "http://prof.lo/index.php?run=$run_id&source=xhprof_foo"; ?>" width="100%" height="800" /> | |
<?php die(); | |
} ); | |
function profile_get_permalink_with_obj( $post_id ) { | |
get_permalink( $post_id, false, true ); | |
} | |
function profile_get_permalink_with_id( $post_id ) { | |
get_permalink( $post_id, false, false ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment