...

View Full Version : What kind of information is acquired when profiling a php script



crmpicco
06-16-2010, 10:16 PM
Hi all,

Can anyone advise on this question that has came up in a practice Zend exam:

What kind of information is acquired when profiling a php script (choose 2):

A. a list of all of the op-codes executed by the engine
B. the files and functions and/or parameters which where executed during the php script
C. the execution times of files and functions during the php script
D. a list of all the variables used in a php script
E. a list of errors which have occurred

Best Regards,
Picco
:confused:

Fou-Lu
06-16-2010, 11:16 PM
This is an ambiguous question.
Different profilers are often used for different purposes.
Hmm tricky tricky. I'd go with C and D. Since you don't need a profiler to list the errors that occured (though the php profilers will), its primary features I'd say would be the execution times and counts for the functions (and memory usage) and the list of the variables (and likely their memory usage). Since the purpose of profiling is to optimize, these should be the two most benifitial ones to use.

crmpicco
06-20-2010, 10:14 PM
Thanks Fou-Lu. It was something I never really had much luck in looking into in terms of research.

That make more sense, I guess if I think of it as more optimisiation rather than debugging or fault finding that might help. Cheers.

Do you have any PHP profiling sources?

Fou-Lu
06-21-2010, 02:43 AM
pecl has a few, I've used the APD which is a debugger but can do some profiling. Seems to be ok: http://php.ca/manual/en/book.apd.php
Zend has an optimizer as well, but I've never used it. I'm pretty sure eclipse uses xdebug for its debugger which sorta has a profile feel, but doesn't report times or counts. There are a number of builtin functions as well that are helpful like debug_backtrace and debug_zval_dump.

Dormilich
06-21-2010, 08:28 AM
I'm pretty sure eclipse uses xdebug for its debugger which sorta has a profile feel, but doesn't report times or counts.

XDebug itself collects that information (available through a CacheGrinder).

Fou-Lu
06-21-2010, 04:34 PM
XDebug itself collects that information (available through a CacheGrinder).

Ah sweet, I didn't know that! +1 to eclipse :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum