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("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s"),
31 round($a->performance["database"] - $a->performance["database_write"], 3),
32 round($a->performance["database_write"], 3),
33 round($a->performance["network"], 2),
34 round($a->performance["rendering"], 2),
35 round($a->performance["parser"], 2),
36 round($a->performance["file"], 2),
37 round($duration - $a->performance["database"]
38 - $a->performance["network"] - $a->performance["rendering"]
39 - $a->performance["parser"] - $a->performance["file"], 2),
41 //round($a->performance["markstart"], 3)
42 //round($a->performance["plugin"], 3)
45 if (get_config("rendertime", "callstack")) {
47 $o .= "\nDatabase Read:\n";
48 foreach ($a->callstack["database"] AS $func => $time) {
49 $time = round($time, 3);
51 $o .= $func.": ".$time."\n";
53 $o .= "\nDatabase Write:\n";
54 foreach ($a->callstack["database_write"] AS $func => $time) {
55 $time = round($time, 3);
57 $o .= $func.": ".$time."\n";
61 foreach ($a->callstack["network"] AS $func => $time) {
62 $time = round($time, 3);
64 $o .= $func.": ".$time."\n";