jokkedk/webgrind

"Total Inclusive Cost" is always 0

Closed this issue · 3 comments

zbuc commented

I have a few XDebug-generated cachegrind files and they all show 0 in all rows for "Total Inclusive Cost".

I saw this issue: http://groups.google.com/group/webgrind-general/browse_thread/thread/89a695623076dbce but it seemed to only be a problem with cachegrind files that did not contain a "summary" line. All of my cachegrind files have "summary" lines and the "Total Self Cost" column is populated correctly for all rows.

I am running the latest webgrind from git trunk and XDebug 2.2.0

Example cachegrind files here:

http://czub.us/media/xdebug/cachegrind.out.32971
http://czub.us/media/xdebug/cachegrind.out.32973
http://czub.us/media/xdebug/cachegrind.out.32974

EDIT: It seems to be something to deal with this line:

        $result['summedInclusiveCost'] = $this->formatCost($result['summedInclusiveCost']);

as $result['summedInclusiveCost'] is set prior to the execution of that line, but not afterwards.

EDIT2: This is only an issue when using "millisecond" view, it has to do with the rounding at line 241 of Reader.php:

    if ($format == 'msec') {
        return round($cost/1000, 0);
    }

EDIT3: I'm thinking there may actually be an issue somewhere in the Preprocessor.php because the getFunctionInfo method in Reader.php is retrieving values with Inclusive Cost greater than Self Cost, which doesn't make sense.

EDIT4: (wow, a lot of edits)

I'm now thinking the binary .webgrind file might be corrupted. I'm seeing weird function names like " ���� � �������������������������������������������� �!�"��#�$�%�&��'�(�)�*�+�,�-��.�/�0�1��2��3�4�5��6�7�8�9��:�;�<���=�>�?�@��A�B�C�D��E�F��G�H�I�J�K�L�M�N" appear and seeing a lot of errors in my PHP log like:

[11-Nov-2011 17:35:27] PHP Warning:  json_encode() [<a href='function.json-encode'>function.json-encode</a>]: Invalid UTF-8 sequence in argument in /Users/chrisczub/repos/webgrind/index.php on line 120
[11-Nov-2011 17:35:27] PHP Stack trace:
[11-Nov-2011 17:35:27] PHP   1. {main}() /Users/chrisczub/repos/webgrind/index.php:0
[11-Nov-2011 17:35:27] PHP   2. json_encode() /Users/chrisczub/repos/webgrind/index.php:120

[11-Nov-2011 17:35:27] PHP Notice:  Undefined offset: 33554432 in /Users/chrisczub/repos/webgrind/library/Reader.php on line 109
[11-Nov-2011 17:35:27] PHP Stack trace:
[11-Nov-2011 17:35:27] PHP   1. {main}() /Users/chrisczub/repos/webgrind/index.php:0
[11-Nov-2011 17:35:27] PHP   2. Webgrind_Reader->getFunctionInfo() /Users/chrisczub/repos/webgrind/index.php:115

Confirmed. A commit by me has broken webgrind. Will look into it soon.

Fixed. Please verify if you can.

zbuc commented

Confirmed fixed, thanks!