View Issue Details

IDProjectCategoryView StatusLast Update
0001710XdebugProfilingpublic2019-10-07 14:49
ReporterenorAssigned Toderick 
PrioritylowSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version2.6.0 
Target Version3.0.0devFixed in Version 
Summary0001710: Doubled recursion count in kcachegrind on select recursive function
DescriptionI tried profiling a recursive function with a little test script. When viewing the cachegrind output in kcachegrind I can see the correct number of function calls when clicking the main entry point in the call graph (27).

However, when i click the recursive function, it shows doubled count (54) which I did not expect.
Steps To Reproduce1. Run the following script in documentRoot with profiling enabled.
2. Inspect the output with kcachegrind.

<?php

$list = ['one', 'two', 'three'];
foreach ($list as $item) {
    outputWithRecursion($item, 10);
}

function outputWithRecursion(string $item, int $countdown): void
{
    $countdown--;
    if ($countdown > 0) {
        echo sprintf('not yet (%d)...', $countdown);
        outputWithRecursion($item, $countdown);
    } else {
        echo sprintf('Finally there: %s(%d)
', $item, $countdown);
    }
}
Additional InformationPHP Version 7.2.19-0ubuntu0.18.04.2

HTTP Response Headers
X-Xdebug-Profile-Filename /var/www/xworkshop/cachegrind.out.832

xdebug support enabled
Version 2.6.0
IDE Key PHPSTORM

# xdebug.ini settings
zend_extension=xdebug.so
xdebug.remote_connect_back=0
xdebug.remote_enable=0
xdebut.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_log=/var/www/xworkshop/remote.log
xdebug.auto_trace=1
xdebug.profiler_enable=1
xdebug.profiler_output_dir=/var/www/xworkshop
TagsNo tags attached.
Operating SystemUbuntu 18.04
PHP Version7.2.15-7.2.19

Activities

enor

2019-10-04 16:59

reporter  

derick

2019-10-07 14:48

administrator   ~0005168

Thanks for filing this ticket. I'll likely address this in Xdebug 3.0, after I've done some major refactoring.

Issue History

Date Modified Username Field Change
2019-10-04 16:59 enor New Issue
2019-10-04 16:59 enor File Added: cachegrind_recursion_main.png
2019-10-04 16:59 enor File Added: cachegrind_recursion_output.png
2019-10-07 14:48 derick Assigned To => derick
2019-10-07 14:48 derick Status new => acknowledged
2019-10-07 14:48 derick Note Added: 0005168
2019-10-07 14:49 derick Target Version => 3.0.0dev