NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
howto get results from: dbg_get_profiler_results


Joined: 03 Feb 2006
Posts: 5
Reply with quote
Hello,

The call dbg_get_profiler_results( $result ) does not give me the results I was expecting. This is no reference problem because $result is filled with 6 sub-array's but these are all empty.

I suspect that the profiles was disabled for some reason, but I can't fugure out how to enable it.

Any help is appreciated, some configuration info follows...

from phpinfo():
Version 2.11.32
Linked as a shared library.
Profiler compiled, enabled
debugger.enable_session_cookie On On
debugger.enabled On On
debugger.fail_silently On On
debugger.ignore_nops Off Off
debugger.JIT_enabled Off Off
debugger.JIT_host clienthost clienthost
debugger.JIT_level 3 3
debugger.JIT_port 7869 7869
debugger.profiler_enabled On On
debugger.session_nocache On On
debugger.timeout_seconds 300 300

I run the script by calling:
http://myserver/phpinfo.php?DBGSESSID=1,p=1,d=1

The script phpinfo.php
<?php
function test() { echo "t"; }
test();
test();

$result = null;
dbg_get_profiler_results( $result );

echo "<pre>";
ehco print_r( $result, true );
echo "</pre>";

The resulting webpage
tt
Array
(
[mod_no] => Array
(
)

[line_no] => Array
(
)

[hit_count] => Array
(
)

[tm_max] => Array
(
)

[tm_min] => Array
(
)

[tm_sum] => Array
(
)

)

The server is a 486, 50Mhz
PHP 5.1.1
Zend Engine v2.1.0
DBG v2.11.32
View user's profileFind all posts by frayjaSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
In dbg-2.11 profiler starts only with debugger. So you have to start debug session, proceed with executing your script up to the last line where you may call profiler-related functions. I'd recommend you take a look at the sample first.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 03 Feb 2006
Posts: 5
Reply with quote
I understand that in order to view the profiling information, the debugger has to be started...

So, probably a very simple question, but how do I start the debugger? Without actually debugging. I'm afraid that I'm not using the prefered editor phpED, but emacs... this does have GDB (General DeBugger, the engine behind the better known DDD) support, but to my knowledge GDB does not work throught a socket...

You recommendation about the sample file... I don't see where that file helps me... it gives the nice idea that that particular script can be included with each webpage, and it includes some code that generates a human readable table, but I don't see anything related to actually starting the debugger...

I'm a bit confused at the moment, hopefully you can clarify it a bit...

Regards,
Frayja
View user's profileFind all posts by frayjaSend private message


Joined: 03 Feb 2006
Posts: 5
Reply with quote
Ok, I have something working, but it's most likely not the way it's supposed to work...

I downloaded the debug client, asked it to listen on the host called 'frayja' on port 9999.
I called the website with the following url: http://myserver/phpinfo.php?DBGSESSID=1@myclientmachine:7869;d=1,p=1

When i switched back to the debug client program, I typed 'cont', and the php program continued... finishing with the profiling information on the browser window... GREAT! It worked!

But...

This can't be the way that it's supposed to work... I'm don't want to go to the debug program, to say 'continue' followed by 'listen' every time... Isn't there a way to tell the debug client to 'always listen' and 'always continue'?

Greeting,
Frayja
View user's profileFind all posts by frayjaSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
Quote:
don't want to go to the debug program, to say 'continue' followed by 'listen' every time

put them into the command line or command file.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 03 Feb 2006
Posts: 5
Reply with quote
Ok, my problems are over now Very Happy thanks a bunch!

For those that only want the profiling information, without the debugging... this is what I did:

1. I downloaded the debug-client http://www.php-debugger.com/dbg/downloads.php, look for 'dbg-cli'
2. I made the following init script for this program, '~/.dbgcli_init' and I put the following lines in:
set port 9999
listen
cont
quit

3. Then I made a bash script that repeatedly started the 'dbg-cli' executable

This way, every time the php program is run, a connection can be made to the listening debug-client. The program immediately runs, and then the debug-client closes. Then it is started again, in an infinite loop, always ready to serve me with wonderfull profiling information Very Happy


On a side note, there were two things that (in my opinion) weren't correct:
1. The README file that comes with the dbg-cli executable says that the init file is called ~/dbgcli_init. This is wrong! It looks for the hidden file ~/.dbgcli_init.
2. When I start the dbg-cli with the command 'dbg-cli --port=9999', this port setting is used AFTER the init file is read. This gave me problems because at first I didn't set the port number in the .dbgcli_init file, and it listend on the wrong port number, even though I passed the correct port number along with the command line parameter.

Thanks for the help!

Regards,
Frayja
View user's profileFind all posts by frayjaSend private message
howto get results from: dbg_get_profiler_results
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic