function compare_point(profile_point $a, profile_point $b) { // @codingStandardsIgnoreStart global $sort; // @codingStandardsIgnoreEnd 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; case 'time_per_call': return $a->timePerCall() > $b->timePerCall() ? -1 : 1; case 'memory_per_call': return $a->memoryPerCall() > $b->memoryPerCall() ? -1 : 1; case 'calls_per_req': return $a->callsPerRequest() > $b->callsPerRequest() ? -1 : 1; case 'time_per_req': return $a->timePerRequest() > $b->timePerRequest() ? -1 : 1; case 'memory_per_req': return $a->memoryPerRequest() > $b->memoryPerRequest() ? -1 : 1; } }
function compare_point(profile_point $a, profile_point $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; case "time_per_call": return $a->timePerCall() > $b->timePerCall() ? -1 : 1; case "memory_per_call": return $a->memoryPerCall() > $b->memoryPerCall() ? -1 : 1; case "calls_per_req": return $a->callsPerRequest() > $b->callsPerRequest() ? -1 : 1; case "time_per_req": return $a->timePerRequest() > $b->timePerRequest() ? -1 : 1; case "memory_per_req": return $a->memoryPerRequest() > $b->memoryPerRequest() ? -1 : 1; } }
global $filter, $sort, $expand; if ($_expand === false) { $_expand = $expand; } $nfilter = $_filter ? $_filter : $filter; $nsort = $_sort ? $_sort : $sort; $exp = urlencode(implode(',', array_keys($_expand))); return "?filter={$nfilter}&sort={$nsort}&expand={$exp}"; } $points = array(); $queries = array(); $sqltotal = 0.0; $last = false; while (($o = mysql_fetch_object($res)) !== false) { $next = new profile_point($o->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);
if ($_expand === false) { $_expand = $expand; } $nfilter = $_filter ? $_filter : $filter; $nsort = $_sort ? $_sort : $sort; $exp = urlencode(implode(',', array_keys($_expand))); return "?filter={$nfilter}&sort={$nsort}&expand={$exp}"; } $points = array(); $queries = array(); $sqltotal = 0.0; $last = false; while (($o = mysql_fetch_object($res)) !== false) { $next = new profile_point($o->pf_name, $o->pf_count, $o->pf_time); if ($next->name() == '-total') { $totaltime = $next->time(); $totalcount = $next->count(); } 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; }
function getEscapedProfileUrl($_filter = false, $_sort = false, $_expand = false) { global $filter, $sort, $expand; if ($_expand === false) { $_expand = $expand; } return htmlspecialchars('?' . wfArrayToCGI(array('filter' => $_filter ? $_filter : $filter, 'sort' => $_sort ? $_sort : $sort, 'expand' => implode(',', array_keys($_expand))))); } $points = array(); $queries = array(); $sqltotal = 0.0; $last = false; foreach ($res as $o) { $next = new profile_point($o->pf_name, $o->pf_count, $o->pf_time, $o->pf_memory); if ($next->name() == '-total') { profile_point::$totaltime = $next->time(); profile_point::$totalcount = $next->count(); profile_point::$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()) || preg_match("/^query-m: /", $next->name())) { $sqltotal += $next->time(); $queries[] = $next; } else { $points[] = $next;