Last active
November 10, 2015 11:23
-
-
Save walterebert/431c4ea2c9f353a6971d to your computer and use it in GitHub Desktop.
WordPress snippet: Profiler
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 | |
function my_profiler() | |
{ | |
printf( | |
'<!-- %d queries in %.3f seconds using %.2fMB memory -->', | |
get_num_queries(), | |
timer_stop( 0, 3 ), | |
memory_get_peak_usage() / 1024 / 1024 | |
); | |
} | |
if ( WP_DEBUG ) { | |
add_action( 'wp_print_footer_scripts', 'my_profiler' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment