Best Practice Method for Finding Runtime in the Zend Framework

I am interested in the best / standard way to find the runtime of my Zend Framework application. I am currently running a timer on public / index.php and then registering it with Zend_Registry for a subsequent call, which then uses the layout to calculate the total time.

Is there a better way to do this? I know that this is not even entirely accurate, as there is still (or at least maybe) some execution in postDispatch () that will be launched after the view is rendered.

+4
source share
3 answers

I ended up adding

$appStartTime = microtime(); 

before the bootloader got intsantiated and put

 global $appStartTime; @list( $startMilli, $startSeconds, $endMilli, $endSeconds) = explode(' ',$appStartTime . ' ' . microtime()); $generateTime = ($endSeconds+$endMilli)-($startSeconds+$startMilli); printf( '. Generated in %.3fs', $generateTime); if ($generateTime > 1) // one second { Zend_Registry::get( 'logger' )->warn( 'Long page load time of ' . $generateTime . ' on ' . Zend_Controller_Front::getInstance()->getRequest()->getRequestUri() ); } 

at the end of my layout.phtml, as the last one before the closing body tag

+3
source

I myself use webgrind and xdebug profiling. This gives information not only about the total execution time, but also, for example, how many times the given method was executed, what is the time of this execution, etc.

+3
source

You might want to learn about a real code profiler like XHProf .

+1
source

All Articles