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 $ignored_modules = array("fbrowser");
30 $ignored = in_array($a->module, $ignored_modules);
32 if (is_site_admin() AND ($_GET["mode"] != "minimal") AND !$a->is_mobile AND !$a->is_tablet AND !$ignored) {
33 $o = $o.'<div class="renderinfo">'.sprintf(t("Database: %s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s"),
34 round($a->performance["database"], 3),
35 round($a->performance["network"], 3),
36 round($a->performance["rendering"], 3),
37 round($a->performance["parser"], 3),
38 round($a->performance["file"], 3),
39 round($duration - $a->performance["database"] - $a->performance["network"]
40 - $a->performance["rendering"] - $a->performance["parser"]
41 - $a->performance["file"], 3),
43 //round($a->performance["markstart"], 3)
44 //round($a->performance["plugin"], 3)
47 if (get_config("rendertime", "callstack")) {
49 $o .= "\nDatabase:\n";
50 foreach ($a->callstack["database"] AS $func => $time) {
51 $time = round($time, 3);
53 $o .= $func.": ".$time."\n";
57 foreach ($a->callstack["network"] AS $func => $time) {
58 $time = round($time, 3);
60 $o .= $func.": ".$time."\n";