kmukesh343 / webgrind

Automatically exported from code.google.com/p/webgrind
Other
0 stars 0 forks source link

Wrong 'summary' header counting #25

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
Should be fixed in r135, please verify

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

GoogleCodeExporter commented 8 years ago
r135 works, thnx a lot!

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