[xdebug-dev] Bug 0000077: Profiler doesn't handle recursive functions

From: <xdebug-dev[@]lists.xdebug.org>
Date: Fri, 16 Jul 2004 06:16:53 +0200

The following NEW bug has been ADDED.
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000077
======================================================================
Reporter: Roger Keays
Handler:
======================================================================
Project: Xdebug
Bug ID: 77
Category: Usage problems
Reproducibility: always
Severity: major
Priority: normal
Status: new
Operating System:
PHP Version: 4.3.0
Xdebug Version: 2.0-dev
======================================================================
Date Submitted: 2004-07-16 06:16 CEST
Last Modified: 2004-07-16 06:16 CEST
======================================================================
Summary: Profiler doesn't handle recursive functions
Description:
The xdebug profiler seems to be unable to handle recursion properly. given
the script:
 
<?php
 
function c() {
  d();
}
function d() {
 
  static $x;
  if (!isset($x)) $x = 0;
  $x++;
  while ($x < 20) c();
}
 
c();
 
?>
 
We see the results
 
c() - cumulative: 1014.75% self: 49.36%
d() - cumulative: 965% self: 47.87%
main - cumulative: 100% self: 2.66%
 
self still sums to approx 100%, but the cumulative time is all wrong.

Having a look at the cachegrind.out file it is pretty clear what is
happening - xdebug is counting the first call to d() in the total of the
second call to d() - which is okay, but since it prints both to the file
you end up with the equivalent of 3 calls to d().

I wouldn't accept filtering the linked list for function names the match
the exiting function when summing totals as a valid solution for this
defect, since recursion may be hidden at a distance of more than 1
function call away.

Can't think of a quick fix for this one...
======================================================================

Bug History
Date Modified Username Field Change
======================================================================
2004-07-16 06:16Roger Keays New Bug
======================================================================
Received on Fri Jul 16 2004 - 06:16:58 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:02 BST