Horje
How to Display DB Queries, Time Spent and Memory Consumption

Display DB Queries, Time Spent and Memory Consumption

Just copy and paste following codes to yourdomain.com/wp-content/themes/activated-theme/fucntions.php in the most below.

Example: 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} -->" ;
}

Then

this code below the code above which will automatically insert the code above into the footer of your public website (make sure your theme is calling wp_footer):
add_action( 'wp_footer', 'performance', 20 );

It can be called multiple times.





Related Articles
How to Display DB Queries, Time Spent and Memory Consumption Wordpress Database Shortcode

Single Articles
Display DB Queries, Time Spent and Memory ConsumptionWordpress Database Shortcode
ThenWordpress Database Shortcode

Read Full:
Wordpress Database Shortcode
Category:
Web Tutorial
Sub Category:
Wordpress Database Shortcode
Uploaded:
11 months ago
Uploaded by:
Admin
Views:
25



Share on: