Questions answered by this recipe
How can I measure the performance of my wiki?
How can I can see how long individual operations are taking to execute?
The $StopWatch function allows you to measure the time it takes to generate wiki pages. It's a profiling/logging feature, so that you can see how long individual operations are taking to execute and to provide some debugging output.
Enabling the stopwatch
To enable the stopwatch, use:
$EnableDiag = 1; $EnableStopWatch = 1; $HTMLFooterFmt['stopwatch'] = 'function:StopWatchHTML 1';
Adding stopwatch entries
To add an entry to the stopwatch log (e.g., from a custom recipe or function), it's just
The first call to StopWatch() is always considered to be time "zero"
-- all other times are relative to that. Setting
to 1 will display the wall-clock time; systems that support PHP's
getrusage() function (typically Unix/Linux) can set
to 2 to get the wall-clock time and the CPU time.
Also, you can put "$StopWatch" somewhere in the skin template to see the stopwatch results.