Created
November 25, 2014 21:44
-
-
Save ericmann/296897ca4195afe4eca5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
$query_timer = 0; | |
add_filter( 'do_parse_request', function( $parse ) { | |
global $query_timer; | |
$query_timer = microtime( true ); | |
return $parse; | |
} ); | |
add_action( 'parse_request', function() { | |
global $query_timer; | |
$time = microtime( true ) - $query_timer; | |
add_action( 'wp_head', function() use ( $time ) { | |
echo '<!-- timer: ' . $time . ' -->'; | |
} ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment