What is the code to show how long it took for PHP to process a page?
Also, how many sql queries were performed to generate that page?
For the first question.
$start = microtime(true);
$end = microtime(true);
printf("Page was generated in %f seconds", $end - $start);
The second one is a little more complicated. You need an shared gateways that keeps tracks of all your queries and stores an execution counter. The most simple example can be a wrapper method around the mysql_query that increments a static variable and then passes the query to mysql_query.
The most part of modern ORM implements that feature, if you already use one of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With