MODX Quick Tip: PHP Execution Time and Cache Info

Nov 21, 2012

Burning Questions

How long did MODX take to generate that page? Was the data cached? Or am I querying the database? What was the affect of calling that Snippet cached vs uncached?

[ ^p^ ] [ ^t^ ] [ ^s^ ]
Break it down:

NOTE: The spaces between the square brackets and carats are for display purposes only. To make the tags work, omit the spaces. Put the tags in your template or content somewhere. They will output the following:

  • [ ^p^ ] » PHP Execution Time.
  • [ ^t^ ] » Total Time to generate page. There's a more technical term for this, I'm sure..."Time-to-first-byte"? Someone school me in the comments please.
  • [ ^s^ ] » Will output "cache" if loaded from cache. If any content was from the database, it'll say that instead.

You can also try Jason Coward's Executioner Snippet. It's pretty cool. But the quick and dirty is shown above - it comes with MODX core. Yes, they look like Evo tags, but they work in Revo. Yes they use carats instead of the other Revo tokens. Yes I owe this knowledge to Jason Coward.

That's all folks. Go time some pages and optimize them with getCache!