summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjokkedk <joakim@jokke.dk>2008-10-03 14:48:40 +0000
committerjokkedk <joakim@jokke.dk>2008-10-03 14:48:40 +0000
commit6114a93e05a4b3bb37e77123ebe390e372a99ac2 (patch)
treef35bb420110c79bbba19aaaaf83f0c7ab2d9ecd9
parent897d035c25a6e244aafb8add52aeb4e13c4eadd3 (diff)
downloadwebgrind-6114a93e05a4b3bb37e77123ebe390e372a99ac2.zip
webgrind-6114a93e05a4b3bb37e77123ebe390e372a99ac2.tar.gz
webgrind-6114a93e05a4b3bb37e77123ebe390e372a99ac2.tar.bz2
- Fixed #25 for appended profiles. Percentage calculated correctly, output shows number of runs.
-rw-r--r--index.php1
-rw-r--r--library/Reader.php11
-rw-r--r--templates/index.phtml3
3 files changed, 13 insertions, 2 deletions
diff --git a/index.php b/index.php
index 10e3ffb..254d209 100644
--- a/index.php
+++ b/index.php
@@ -84,6 +84,7 @@ switch(get('op')){
$result['summedRunTime'] = $reader->formatCost($reader->getHeader('summary'), 'msec');
$result['dataFile'] = $dataFile;
$result['invokeUrl'] = $reader->getHeader('cmd');
+ $result['runs'] = $reader->getHeader('runs');
$result['breakdown'] = $breakdown;
$result['mtime'] = date(Webgrind_Config::$dateFormat,filemtime(Webgrind_Config::xdebugOutputDir().$dataFile));
echo json_encode($result);
diff --git a/library/Reader.php b/library/Reader.php
index 120b06a..c5e1b56 100644
--- a/library/Reader.php
+++ b/library/Reader.php
@@ -182,9 +182,18 @@ class Webgrind_Reader
function getHeaders(){
if($this->headers==null){ // Cache headers
$this->seek($this->headersPos);
+ $this->headers['runs'] = 0;
while($line=$this->readLine()){
$parts = explode(': ',$line);
- $this->headers[$parts[0]] = $parts[1];
+ if ($parts[0] == 'summary') {
+ $this->headers['runs']++;
+ if(isset($this->headers['summary']))
+ $this->headers['summary'] += $parts[1];
+ else
+ $this->headers['summary'] = $parts[1];
+ } else {
+ $this->headers[$parts[0]] = $parts[1];
+ }
}
}
return $this->headers;
diff --git a/templates/index.phtml b/templates/index.phtml
index 103a886..98cfc35 100644
--- a/templates/index.phtml
+++ b/templates/index.phtml
@@ -44,6 +44,7 @@
$("#shown_sum").html(data.functions.length);
$("#invocation_sum").html(data.summedInvocationCount);
$("#runtime_sum").html(data.summedRunTime);
+ $("#runs").html(data.runs);
var breakdown_sum = data.breakdown['internal']+data.breakdown['user']+data.breakdown['class']+data.breakdown['include'];
$("#breakdown").html(
@@ -288,7 +289,7 @@
</div>
<div style="float:right;">
<div id="breakdown" style="margin-bottom:5px;width:320px;height:20px"></div>
- <span id="invocation_sum"></span> different functions called in <span id="runtime_sum"></span> milliseconds (<span id="shown_sum"></span> shown)
+ <span id="invocation_sum"></span> different functions called in <span id="runtime_sum"></span> milliseconds (<span id="runs"></span> runs, <span id="shown_sum"></span> shown)
</div>
<div style="clear:both"></div>
<table class="tablesorter" id="function_table" cellspacing="0">