name = $name; $this->count = $count; $this->time = $time; $this->memory = $memory; $this->children = array(); } function add_child($child) { $this->children[] = $child; } function display($indent = 0.0) { global $expand, $totaltime, $totalmemory, $totalcount; 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 = " [–]"; } ?> name()) . $extet ?> fmttime() ?> time() / $totaltime * 100 ) ?> memory() / $totalmemory * 100 ) ?> count() ?> count() / $totalcount ), 2 ) ?> time() / $this->count() ), 2 ) ?> memory() / $this->count() / 1048576 ), 2 ) ?> children as $child) $child->display($indent + 2); } function name() { return $this->name; } function count() { return $this->count; } function time() { return $this->time; } function memory() { return $this->memory; } 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 "memory": return $a->memory() > $b->memory() ? -1 : 1; case "count": return $a->count() > $b->count() ? -1 : 1; } } $sorts = array("time", "memory", "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_memory, pf_name FROM {$wgDBprefix}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, $o->pf_memory); if( $next->name() == '-total' ) { $totaltime = $next->time(); $totalcount = $next->count(); $totalmemory = $next->memory(); } 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, 0, 0); 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(); } ?>
">Name ">Time (ms) Time (%) ">Memory (%) ">Count Calls/request ms/call kb/call

Total time: