Hi,
Thanks for a great tool! Loads better than the alternatives.
My setup is as follows: PHP 5.1.2, IIS 5, Windows XP, php_xdebug-5.1.1-2.0.0beta5.dll
I’m using xdebug to profile my php application, and I
noticed something odd in the “self” times of some of my scripts. It
turns out that when file A does a require_once() on a file B that contains only
function and class definitions, that the time spent loading the function and
class definitions is not added to the self time of file B, but to the self time
of file *A*.
Now this is understandable if the classes are only actually
loaded in script A and not in script B. But there’s more.
In my setup, script A loads script B. Script B loads script
C. Script C has class and function definitions. The time spent in C is added to
B’s self time, not A’s self time!
Is there something about the class loading of PHP that I don’t
understand?
Would it be possible to put entries in the profiles output
for when a class or function is defined?
Kindest regards,
Gustav Bertram
CST Digital Communication (Pty)
Here’s my example code for the A loads B example.
Example:
Test.php:
“””
<?php
require_once("class.rss.php");
require_once("class.user.php");
require_once("class.details.php");
require_once("class.folder.php");
require_once("class.message.php");
require_once("class.draft.php");
require_once("func.elements.php");
?>
<wml>
<card title="title">
<p>
qzna!
</p>
</card>
</wml>
“””
All the class.*.php contain class definitions. The
func.elements.php contains function definitions. When I profile the above file,
I get the following output:
cachegrind.out.1072788529:
“””
version: 0.9.6
cmd: C:\Inetpub\waproot\Ver2.24\test.php
part: 1
events: Time
fl=C:\Inetpub\waproot\Ver2.24\class.rss.php
fn=require_once::C:\Inetpub\waproot\Ver2.24\class.rss.php
1 40
fl=C:\Inetpub\waproot\Ver2.24\class.user.php
fn=require_once::C:\Inetpub\waproot\Ver2.24\class.user.php
1 28
fl=C:\Inetpub\waproot\Ver2.24\class.details.php
fn=require_once::C:\Inetpub\waproot\Ver2.24\class.details.php
1 69
fl=C:\Inetpub\waproot\Ver2.24\class.folder.php
fn=require_once::C:\Inetpub\waproot\Ver2.24\class.folder.php
1 119
fl=C:\Inetpub\waproot\Ver2.24\class.message.php
fn=require_once::C:\Inetpub\waproot\Ver2.24\class.message.php
1 100
fl=C:\Inetpub\waproot\Ver2.24\class.draft.php
fn=require_once::C:\Inetpub\waproot\Ver2.24\class.draft.php
1 11
fl=C:\Inetpub\waproot\Ver2.24\func.elements.php
fn=require_once::C:\Inetpub\waproot\Ver2.24\func.elements.php
1 40
fl=C:\Inetpub\waproot\Ver2.24\test.php
fn={main}
summary: 268168
0 267758
cfn=require_once::C:\Inetpub\waproot\Ver2.24\class.rss.php
calls=1 0 0
2 40
cfn=require_once::C:\Inetpub\waproot\Ver2.24\class.user.php
calls=1 0 0
3 28
cfn=require_once::C:\Inetpub\waproot\Ver2.24\class.details.php
calls=1 0 0
4 69
cfn=require_once::C:\Inetpub\waproot\Ver2.24\class.folder.php
calls=1 0 0
5 119
cfn=require_once::C:\Inetpub\waproot\Ver2.24\class.message.php
calls=1 0 0
6 100
cfn=require_once::C:\Inetpub\waproot\Ver2.24\class.draft.php
calls=1 0 0
7 11
cfn=require_once::C:\Inetpub\waproot\Ver2.24\func.elements.php
calls=1 0 0
8 40
“””