[EXTENSION] PhpQuickProfiler

This is the Forum discussion for the PHP Quick Profiler extension

Please post any doubts here, and not in the extension page when possible.

Is it possible that you are not logging anything? try adding system.* to your categories, if you do not see anything after that then please paste your configuration so that I can help you further.

Nice.

The memory log is something that could be added to the framework itself.

I’m seeing a rather odd problem.

Some of the log messages in the PhpQuickProfiler are missing parts of the text. For example, PQP reports the last like of one query as:


left join genre g2 on g2.id = dg2.genre_id group by u.id, dg2.is_primary LIMIT 50

while in protexted/runtime/application.log:


left join genre g2 on g2.id = dg2.genre_id where (c.user_id is not null) group by u.id, dg2.is_primary LIMIT 50

very odd.

do you have a regexp tidying up the strings for display that is perhaps being a bit too agressive?

There are no regex, nor log processing, its very strange, are you entirely sure you are talking about the same query? can you isolate the query to be sure?

Very nice extension, thanks!

Is it possible to log page execution speed as described in following link, too?

http://particletree.com/features/php-quick-profiler/

Sure you can, and also in a better way than described, thats all thanks to Yii’s profiling methods.

When they talk about object factory and object engine, you can just wrap the execution of those calls inside Yii::begindProfile/endProfile, to find out whats the execution time of calling exactly that code. which is a lot better than calculating the time difference by hand.

Also, as for the example, if you want to log code execution to a point in time, you can just call


 Yii::trace("Time taken to get to line ".__LINE__." ".Yii::getLogger()->getExecutionTime());

It will show in your console tab though. but I don’t see the need when you can profile code blocks.

It looks awesome! I have a few questions and comments.

First of all, all queries are displayed in ms (milliseconds) but in fact they are in seconds.

Second, the"load time" and "memory used" tabs do not work for me. They both display "This panel has no log items". Did I miss any configuration?

Lastly, the profiler only appears if there is a database call. Some users might be confused and thought not working.

thanks for you feedback, it is very much appreciated.

Ill take a look into the milliseconds thing.

As for your other questions:

  • Load time, most known as the Speed tab, only shows data if you have profiled anything within your application, using Yii::beginProfile() and Yii::endProfile()

  • The Memory Tab (memory used), only shows data if you have logged something using, PQPLogRoute::logMemory(),

  • The log may not show anything if nothing has been logged. you can log things using the aforementioned methods, and using Yii::trace and Yii::log, you can also add "system.*" to your categories in order to let the system trace framework information.

Thanks Asgaroth, crystal clear!

This extension will definitely speed up the development! I am all for it.

I got this strange error in unit testing after installing PhpQuickProfiler.




PHP Fatal error:  Uncaught exception 'CException' with message 'CAssetManager.basePath "/usr/bin/assets" is invalid. Please make sure the directory exists and is writable by the Web server process.' in /Applications/MAMP/htdocs/yiiPath/framework/web/CAssetManager.php:112

Stack trace:

#0 /Applications/MAMP/htdocs/yiiPath/framework/web/CAssetManager.php(97): CAssetManager->setBasePath('/usr/bin/assets')

#1 /Applications/MAMP/htdocs/yiiPath/framework/web/CAssetManager.php(207): CAssetManager->getBasePath()

#2 /Applications/MAMP/htdocs/trackstar/protected/extensions/pqp/PQPLogRoute.php(48): CAssetManager->publish('/Applications/M...')

#3 /Applications/MAMP/htdocs/yiiPath/framework/logging/CLogRouter.php(65): PQPLogRoute->init()

#4 /Applications/MAMP/htdocs/yiiPath/framework/base/CModule.php(372): CLogRouter->init()

#5 /Applications/MAMP/htdocs/yiiPath/framework/base/CModule.php(477): CModule->getComponent('log')

#6 /Applications/MAMP/htdocs/yiiPath/framework/base/CApplication.php(142): CModule->preloadComponents()

#7 /Applications in /Applications/MAMP/htdocs/yiiPath/framework/web/CAssetManager.php on line 112




If I comment out the installation in the main.php, the problem go away and unit test works fine. Any suggestions please?




/*

array(

     'class' => 'application.extensions.pqp.PQPLogRoute',

     'categories' => 'application.*, exception.*',

  ),

*/



Sorry to be rude but RTFM there is a note about unit testing in the installation steps

Ha, my bad. I totally miss that part. It is a nice hack to isolate command line process. :D

Hi, the PQP extension is really cool but I can’t make it work integrating with my application’s controllers. I followed the steps from http://www.yiiframework.com/extension/phpquickprofiler/ and it seems working when I access the PQPLogRoute class directly with my local url local.yii.com/PQPLogRoute. But when I insert logs (using Yii::trace, Yii::log, Yii::beginProfile and Yii::endProfile or PQPLogRoute::logMemory) in other controllers I can’t see the logs. Where can I see the logs? Thanks. I hope there is a video demo for this exciting extension :)

Oh yes! Figured it out, the $this->render(‘index’); line was not added to my controller’s action that’s why it didn’t showed up.