Page generated in 0.xxxxx seconds is a simple subtraction of [man]microtime/man outputs.
<?php
$start = microtime();
// All your php code here.....
$end = microtime();
echo 'Page generated in '.($end-$start).' seconds';
As for %php and %mysql; not sure.
As for the "with XX queries", that's easy. They use a database abstraction layer and that holds either a count or history of queries run for that session. Then just at the end, you can [man]count/man that number and display it (or if you're using OOP, create a method to return that data).
You could look at CakePHP for an example of how they do it because they actually show every query that was run, the number of rows it returned, any errors it had, and something else. Very good debug information (sometimes).