View Issue Details

IDProjectCategoryView StatusLast Update
0001710XdebugProfilingpublic2021-05-12 19:11
Reporterenor Assigned To 
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionduplicate 
Product Version2.6.0 
Target Version3.1dev 
Summary0001710: Doubled recursion count in kcachegrind on select recursive function
Description

I 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 Reproduce
  1. 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 Information

PHP 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

Relationships

duplicate of 0000077 acknowledgedderick Profiler doesn't handle recursive functions 

Activities

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.