6 * Description: Shows the time that was needed to render the current page
8 * Author: Michael Vvogel <http://pirati.ca/profile/heluecht>
12 function rendertime_install() {
13 register_hook('init_1', 'addon/rendertime/rendertime.php', 'rendertime_init_1');
14 register_hook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end');
18 function rendertime_uninstall() {
19 unregister_hook('init_1', 'addon/rendertime/rendertime.php', 'rendertime_init_1');
20 unregister_hook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end');
23 function rendertime_init_1(&$a) {
24 global $rendertime_start;
26 $rendertime_start = microtime(true);
29 function rendertime_page_end(&$a, &$o) {
30 global $rendertime_start;
32 $duration = round(microtime(true)-$rendertime_start, 3);
34 $o = $o.'<div class="renderinfo">'.sprintf(t("This page took %s seconds to render"), $duration)."</div>";