uranusmars / webgrind

Automatically exported from code.google.com/p/webgrind

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong 'summary' header counting

GoogleCodeExporter opened this issue · comments

1. use Webgrind to show my file
2. select "show percent"

Percents counting is wrong.  It is because summary time counting is wrong.
 It is because 'summary' header in cachegrind.out can appears multiple
times, but Webgrind count only last one.

$ grep -n summary cachegrind.out.current
10457:summary: 979732
26146:summary: 1400280
27733:summary: 169586
36305:summary: 515360
36538:summary: 2604
53556:summary: 410313
58639:summary: 536714
59399:summary: 989956
68154:summary: 945163
76826:summary: 413992
77059:summary: 3331

I use 0.81 version of Webgrind and 2.0.3 version of xdebug.  xdebug config is:
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp/
xdebug.profiler_append = 1
xdebug.profiler_output_name = cachegrind.out.current
xdebug.auto_trace = 1

The following patch solves 'summary time' problem, but I don't know which
problems still exists :(

$ diff -u Reader.php.orig Reader.php                
--- Reader.php.orig     2008-10-02 20:25:54.000000000 +0700
+++ Reader.php 2008-10-02 20:22:32.000000000 +0700
@@ -184,7 +184,9 @@
                        $this->seek($this->headersPos);
                        while($line=$this->readLine()){
                                $parts = explode(': ',$line);
-                               $this->headers[$parts[0]] = $parts[1];
+                               if(isset($this->headers[$parts[0]]))
+                                       $this->headers[$parts[0]] += $parts[1];
+                               else $this->headers[$parts[0]] = $parts[1];
                        }
                }
                return $this->headers;


PS: sorry, I unable to attach original cachegrind file because of NDA :(
But I able to provide you with a screenshot:
http://flickr.com/photos/grundik/2907329718/sizes/o/

Original issue reported on code.google.com by rkosola...@gmail.com on 2 Oct 2008 at 1:52

Thanks for the bugreport. The problem you mention appears only when xdebug has 
been set to append new 
reports to the existing file. We will look into supporting this.

Original comment by gugakf...@gmail.com on 3 Oct 2008 at 2:39

  • Changed state: Accepted
Should be fixed in r135, please verify

Original comment by gugakf...@gmail.com on 3 Oct 2008 at 2:50

  • Changed state: Fixed
r135 works, thnx a lot!

Original comment by rkosola...@gmail.com on 9 Oct 2008 at 8:07