Move page generation statistics to own method

A number of times I've wanted to get these statistics in my own code, and early enough to use the data. This minor refactoring moves the page generation statistics code to its own module, allowing snippets and plugins to get the data without having to recreate it.

The statistics can be retrieved at any point, allowing the performance of plugins or snippets to be measured using it (no I can't see that being useful, but anyway). It also allows for more creative output onto the page.