Skip to content

Instantly share code, notes, and snippets.

@bradp
Created June 3, 2012 15:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bradp/2863967 to your computer and use it in GitHub Desktop.
Save bradp/2863967 to your computer and use it in GitHub Desktop.
WordPress Database Query Output Monitor
<?php
function performance( $visible = false ) {
$stat = sprintf( '%d queries in %.3f seconds, using %.2fMB memory',
get_num_queries(),
timer_stop( 0, 3 ),
memory_get_peak_usage() / 1024 / 1024
);
echo $visible ? $stat : "<!-- {$stat} -->" ;
}
add_action( 'wp_footer', 'performance', 20 );
@AaronHolbrook
Copy link

This rocks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment