Summary: Display page generation time
Version: 2004-05-05
Prerequisites: Requires at least PmWiki version: 2.0beta; last tested on PmWiki version: pmwiki-2.0.beta35
Maintainer: Anno
Categories: Administration


How long does pmwiki need to generate a page?


This recipe adds the time used to generate a page to the template. Sometimes when a page takes a long time to show up, this is a convenient means to see how long the script needs to generate the page.

Note that PmWiki has a built-in "StopWatch" function that performs a lot of these timings as well. For instructions, see Stopwatch. (--Pm, CarlosAB)


Into you local config.php file insert:

## Page generation timer recipe
$GenerationBegin = microtime();
function GenerationTime(){
	global $GenerationBegin;
	list($begin1, $begin2) = explode(' ', $GenerationBegin);
	list($end1, $end2) = explode(' ', microtime());
	echo round($end1 + $end2 - $begin1 - $begin2, 3);

In your template file (if you are using the default template the file is /pub/skins/pmwiki/pmwiki.tmpl )

search for:


insert just before the last [</div>]:

<br />
<small>Page generated in <!--function:GenerationTime--> seconds.</small>
<br />

Alternative Instructions

  • Download generationtime.phpΔ and place it in your cookbook directory.
  • Add include_once("$FarmD/cookbook/generationtime.php"); to your local/config.php.
  • Anywhere in a page where you want to output the measured value add (:GenerationTime:), for example in the Triad skin you could place it in Site.PageFooter.


See Also

  • Stopwatch - Use the $StopWatch function to measure PmWiki performance.


  • Anno 2004-05-05
  • Gregor 2022-11-25


See discussion at PageGenerationTime-Talk

User notes +2: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.