From cccf275d2f0830ef11f8969392fb891df63d8ba9 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 29 Apr 2008 15:03:21 +0000 Subject: [PATCH] More sorting --- profileinfo.php | 64 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/profileinfo.php b/profileinfo.php index 15b292ac27..7841f78ea0 100644 --- a/profileinfo.php +++ b/profileinfo.php @@ -36,7 +36,7 @@ padding-right: 0.5em; } - td.time, td.timep, td.memory, td.memoryp, td.count, td.cpr { + td.time, td.timep, td.memoryp, td.count, td.cpr, td.tpc, td.mpc, td.tpr, td.mpr { text-align: right; } @@ -112,13 +112,14 @@ class profile_point { name()) . $extet ?> - fmttime() ?> - time() / $totaltime * 100 ) ?> - memory() / $totalmemory * 100 ) ?> + time() / $totaltime * 100 ) ?> + memory() / $totalmemory * 100 ) ?> count() ?> - count() / $totalcount ), 2 ) ?> - time() / $this->count() ), 2 ) ?> - memory() / $this->count() / 1048576 ), 2 ) ?> + callsPerRequest() ), 2 ) ?> + timePerCall() ), 2 ) ?> + memoryPerCall() / 1048576 ), 2 ) ?> + time() / $totalcount ), 2 ) ?> + memory() / $totalcount / 1048576 ), 2 ) ?> memory; } + + function timePerCall() { + return @($this->time / $this->count); + } + + function memoryPerCall() { + return @($this->memory / $this->count); + } + + function callsPerRequest() { + global $totalcount; + return @($this->count / $totalcount); + } + + function timePerRequest() { + global $totalcount; + return @($this->time / $totalcount); + } + + function memoryPerRequest() { + global $totalcount; + return @($this->memory / $totalcount); + } function fmttime() { return sprintf("%5.02f", $this->time); @@ -158,10 +182,20 @@ function compare_point($a, $b) { 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; } } -$sorts = array("time", "memory", "count", "name"); +$sorts = array("time","memory","count","calls_per_req","name","time_per_call","memory_per_call","time_per_req","memory_per_req"); $sort = 'time'; if (isset($_REQUEST['sort']) && in_array($_REQUEST['sort'], $sorts)) $sort = $_REQUEST['sort']; @@ -192,13 +226,14 @@ else $filter = ''; - - + - - - + + + + +
">Name">Time (ms)Time (%)">Time (%) ">Memory (%) ">CountCalls/requestms/callkb/call">Calls/request">ms/call">kb/call">ms/request">kb/request
-

Total time:

+

Total time:

+

Total memory: