name = $name; $this->count = $count; $this->time = $time; $this->children = array(); } function add_child($child) { $this->children[] = $child; } function display($indent = 0.0) { global $expand; usort($this->children, "compare_point"); $extet = ''; if (isset($expand[$this->name()])) $ex = true; else $ex = false; if (!$ex) { if (count($this->children)) { $url = makeurl(false, false, $expand + array($this->name() => true)); $extet = " [+]"; } else $extet = ''; } else { $e = array(); foreach ($expand as $name => $ep) if ($name != $this->name()) $e += array($name => $ep); $extet = " [–]"; } ?> fmttime() ?> count() ?> name()) . $extet ?> children as $child) $child->display($indent + 2); } function name() { return $this->name; } function count() { return $this->count; } function time() { return $this->time; } function fmttime() { return sprintf("%5.02f", $this->time); } }; function compare_point($a, $b) { global $sort; switch ($sort) { case "name": return strcmp($a->name(), $b->name()); case "time": return $a->time() > $b->time() ? -1 : 1; case "count": return $a->count() > $b->count() ? -1 : 1; } } $sorts = array("time", "count", "name"); $sort = 'time'; if (isset($_REQUEST['sort']) && in_array($_REQUEST['sort'], $sorts)) $sort = $_REQUEST['sort']; $dbh = mysql_connect($wgDBserver, $wgDBadminuser, $wgDBadminpassword) or die("mysql server failed: " . mysql_error()); mysql_select_db($wgDBname, $dbh) or die(mysql_error($dbh)); $res = mysql_query(" SELECT pf_count, pf_time, pf_name FROM profiling ORDER BY pf_name ASC ", $dbh) or die("query failed: " . mysql_error()); if (isset($_REQUEST['filter'])) $filter = $_REQUEST['filter']; else $filter = ''; ?>

"/>

pf_name, $o->pf_count, $o->pf_time); $totaltime += $next->time(); if ($last !== false) { if (preg_match("/^".preg_quote($last->name(), "/")."/", $next->name())) { $last->add_child($next); continue; } } $last = $next; if (preg_match("/^query: /", $next->name())) { $sqltotal += $next->time(); $queries[] = $next; } else { $points[] = $next; } } $s = new profile_point("SQL Queries", 0, $sqltotal); foreach ($queries as $q) $s->add_child($q); $points[] = $s; usort($points, "compare_point"); foreach ($points as $point) { if (strlen($filter) && !strstr($point->name(), $filter)) continue; $point->display(); } ?>
">Time ">Count ">Name

Total time: