Page 1 of 1

tracking the code execution

Posted: Thu Sep 07, 2006 12:55 pm
by uki
Hi
I'm currently working on big crm (PHP) application. My boos want me to improve functionality. After 2 days of nothing I'm desperated :(. I'm wondering if ther is a tool(or application) that let me to track which method after which is executing from start to result on screen.

Posted: Thu Sep 07, 2006 2:02 pm
by feyd
Any basic debugger should be able to provide that, if I understand your question correctly.

Many of us use Xdebug around here.

Posted: Thu Sep 07, 2006 3:24 pm
by Chris Corbyn
If you have an idea you can track method calls with Mocks but if you already have the complex system built this will be dfificult to tailor in now.

Xdebug is very nice. If you have the ability to install extensions this is well worthwhile. It's useful for other things such as looking for areas which consume memory too.

Posted: Fri Sep 08, 2006 11:17 am
by uki
What I intend to get is something like this:

I want to know exactly what methods and after what (or from which interior) are executed.
Let's assume I have $App->Run()
And method Run execute $someObject->initialize() , and inside initialize() is other called $this->setVars(),
at the end inside $App->Run() $this->Display() is executed and we se the generated site in webbrowser.
So I want to be able to trace the path of execution in some nice way for example a raport formated for example:

$App->Run()
$someObject->initialize()
$this->setVars()
$this->Display()

Is this debbuger (mentioned in previous posts) able to do sth like this????

Posted: Fri Sep 08, 2006 12:55 pm
by feyd
Yes, Xdebug produces the information you wish.

"sth"? something - For your information: We don't care for aolSpeak here. This isn't a texting service.

Posted: Fri Sep 08, 2006 5:39 pm
by uki
Well I have installed Xdebug installation was successful i've got all additional info running phpinfo();.
I have also insert this to my php.ini
[debbugger]
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=46019
xdebug.remote_handler=gdb
xdebug.profiler_enable=true
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir=/var/www/profilersDir
xdebug.remote_autostart=true
xdebug.auto_trace=true
xdebug.trace_output_dir = /tmp/tmp2

When I made error in script I get info from stacktrace and table with info so I know that Xdebug is working properly.
What is bothering me is that I dont know how to turn on profiler to dispalay info about functions.

How to get this done?? And where I'm suppose to use xdebug_start_profiling() (I've tried inside script but it said that undefined function)

Is there any application that support this??

Posted: Fri Sep 08, 2006 5:42 pm
by feyd
You've got the profiler enabled, it's writing files to the profiler_output_dir location on every page request.

Posted: Fri Sep 08, 2006 6:04 pm
by uki
Well you are right I forgot set up the rights for writing that why i didint se the result in directory. But what to do if I want to print result on screen immediately.

Or How to get this data displayed in a good format (in table??)

I found that KcacheGrid will retrive it well but is there other tool because I'm not going to install KDE just for one tool.

Posted: Fri Sep 08, 2006 6:10 pm
by feyd
It doesn't work that way.

You'll need a tool to process the profiler information such as KCacheGrind or WinCacheGrind.