Display DB queries, time spent and memory consumption

Adding this snippet to the functions.php of your wordpress theme will add a comment to the footer of your wordpress theme with the following statistics. Database queries, time spent and memory consumption.

function performance( $visible = false ) {
    $stat = sprintf(  '%d queries in %.3f seconds, using %.2fMB memory',
        timer_stop( 0, 3 ),
        memory_get_peak_usage() / 1024 / 1024
    echo $visible ? $stat : "<!-- {$stat} -->" ;
add_action( 'wp_footer', 'performance', 20 );

Comments  Leave a Reply

  1. This didn’t work 🙁 didn’t display in footer

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!