[xdebug-general] Re: Mysterious "cycle 2" entry in profile

From: Derick Rethans <derick[@]xdebug.org>
Date: Thu, 20 Sep 2007 09:31:12 +0200 (CEST)

Hello David,

On Mon, 10 Sep 2007, David McCabe wrote:

> I am seeing some confusing and possibly inaccurate profiling results with
> xdebug 2.0.0 and PHP 5.2.3. My phpinfo() output is attached. The program being
> profiled is a custom branch of MediaWiki, which can be found at:
> http://svn.wikimedia.org/viewvc/mediawiki/branches/liquidthreads
>
> In kcachegrind, a 'function' called <cycle 2> (including the brackets) is
> shown as taking 99% of the total execution time. This is distinct from from
> the "cycle 2" annotation which appears on other functions. The <cycle 2>
> 'function' appears to be called from many places throughout the program, and
> to invoke other functions.
>
> I suspect that <cycle 2> may be some kind of allocation or garbage collection
> routine, but couldn't find anything about it with google. Memory usage does
> not go significantly up or down near the places where it appears to be invoked
> from.

The <cycle 2> (and higher numbers) are the result of kcachegrind trying
to do cycle detection. Sometimes it's hard to see how functions called
other functions (especially on recursive functions). When Kcachegrind's
cycle detection is turned on, it will add those "functions" on its own.
You can turn it off in the menu under View->Do Cycle Detection.

regards,
Derick

-- 
Like Xdebug? Send a postcard: http://derickrethans.nl/xdebug_2_released.php
Xdebug | http://xdebug.org | xdebug-general@lists.xdebug.org
Received on Thu Sep 20 2007 - 09:31:12 BST

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST