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('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end');
17 function rendertime_uninstall() {
18 unregister_hook('init_1', 'addon/rendertime/rendertime.php', 'rendertime_init_1');
19 unregister_hook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end');
22 function rendertime_init_1(&$a) {
25 function rendertime_page_end(&$a, &$o) {
27 $duration = microtime(true)-$a->performance["start"];
29 if (is_site_admin() AND ($_GET["mode"] != "minimal") AND !$a->is_mobile AND !$a->is_tablet) {
30 $o = $o.'<div class="renderinfo">'.sprintf(t("Performance: Database: %s, Network: %s, Rendering: %s, Parser: %s, I/O: %s, Other: %s, Total: %s"),
31 round($a->performance["database"], 3),
32 round($a->performance["network"], 3),
33 round($a->performance["rendering"], 3),
34 round($a->performance["parser"], 3),
35 round($a->performance["file"], 3),
36 round($duration - $a->performance["database"] - $a->performance["network"]
37 - $a->performance["rendering"] - $a->performance["parser"]
38 - $a->performance["file"], 3),
40 //round($a->performance["markstart"], 3)
41 //round($a->performance["plugin"], 3)
44 if (get_config("rendertime", "callstack")) {
46 $o .= "\nDatabase:\n";
47 foreach ($a->callstack["database"] AS $func => $time) {
48 $time = round($time, 3);
50 $o .= $func.": ".$time."\n";
54 foreach ($a->callstack["network"] AS $func => $time) {
55 $time = round($time, 3);
57 $o .= $func.": ".$time."\n";