Jump to content

How to display page processing time ?


adrianmak
 Share

Recommended Posts

$timerkey = Debug::timer();

//do lots of things

echo "Lots of things took " . Debug::timer($timerkey) . " seconds to do.";

Note Ryan’s benchmarking tips here: https://processwire.com/blog/posts/processwire-3.0.6-brings-pages-upgrades-and-link-abstraction/#how-to-benchmark-pages

My pw's website is configured to us delay output method

like

$config->prependTemplateFile = '_init.php';

$config->appendTemplateFile = '_main.php';

Should I put   $timerkey = Debug::timer(); at the very beginning of _main.php and

put echo xxxxxxxx . Debug::timer($timerkey) at the bottom and before </body> tag of _main.php ?

Link to comment
Share on other sites

It depends on what you want to measure. If you want to start measuring the time when the prepend file is parsed, thats the right solution.

If you want measure the time from the beginning of execution, you also can start in the _init.php and end in the _main.php. As I said, it completly depends on what you want do. :)

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...