Re: Question on code profiling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Nope. Basically it connects to a database to load an ACL (which at
> [...]
> I thought xdebug was supposed to be a pretty good profiler. If it
> calculating the time correctly, where are the other ~3.6 seconds
> going?

One night I saw a script wait indefinitely for a response from a tanked
database, and PHP's max_execution_time trigger never fired to end the script,
even though it was set to a pretty low value. Some poking around led me to
http://us.php.net/manual/en/function.set-time-limit.php where I found this odd
note:

"Any time spent on activity that happens outside the execution of the script
such as system calls using system(), stream operations, database queries, etc.
is not included when determining the maximum time that the script has been
running. This is not true on Windows where the measured time is real."

The last sentence was particularly confusing because I was running on Windows.

At any rate, if xdebug is using the same mechanism used by set_time_limit() and
max_execution_time, perhaps that could explain your discrepancy?

I second Jonathan's suggestion; I would try calling microtime() before and
after your database query, and before and after anything else that isn't
strictly "execution of the script".

Ben
--
Twitter: @bdunlap

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux