Re: How can I get the execution time of PHP code and DB access?
If possible you should not modify the core - put your function into your application somewhere (perhaps app/config/bootstrap.php so it is available everywhere). That way you can update your Cake core to the newest version without worrying about losing this functionality. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I get the execution time of PHP code and DB access?
Oh and to increse performace look into the caching settings in cake Cheers, Geoff -- http://lemoncake.wordpress.com On Jun 28, 4:21 pm, Geoff Ford [EMAIL PROTECTED] wrote: For query times put DEBUG on level 2 in core.php A table will show at the bottom of the page with all your sql queries including a Took (ms) column. For total page execution - on DEBUG level 2 there is a comment rendered in the source with the execution time (right at the bottom) On Jun 28, 3:36 pm, hi and hello [EMAIL PROTECTED] wrote: I am using cakephp to build a website and at last I found the performance is not very well. So I want to know if it exits a tool by which I can get the execution time of PHP code and DB access? Or how can I write the tool ? thanks very much!!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I get the execution time of PHP code and DB access?
Thank you, but there still exists a problem . Because I use AJAX in my website and return the data as JSON format, so I can not let cakephp append the debug infor to the response. And I want to read the the infor at a console or a log file? Can I do it? On 6月28日, 下午2时21分, Geoff Ford [EMAIL PROTECTED] wrote: For query times put DEBUG on level 2 in core.php A table will show at the bottom of the page with all your sql queries including a Took (ms) column. For total page execution - on DEBUG level 2 there is a comment rendered in the source with the execution time (right at the bottom) On Jun 28, 3:36 pm, hi and hello [EMAIL PROTECTED] wrote: I am using cakephp to build a website and at last I found the performance is not very well. So I want to know if it exits a tool by which I can get the execution time of PHP code and DB access? Or how can I write the tool ? thanks very much!!!- 隐藏被引用文字 - - 显示引用的文字 - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I get the execution time of PHP code and DB access?
If you want to leverage what is already in cake you will need to modify some core files. In cake/libs/model/datasources/dbo_source.php in function execute() (around lines 277-280) you can manually log the query and time ($this- took) to a log file. Same in app/webroot/index.php for total execution time On Jun 28, 5:10 pm, hi and hello [EMAIL PROTECTED] wrote: Thank you, but there still exists a problem . Because I use AJAX in my website and return the data as JSON format, so I can not let cakephp append the debug infor to the response. And I want to read the the infor at a console or a log file? Can I do it? On 6月28日, 下午2时21分, Geoff Ford [EMAIL PROTECTED] wrote: For query times put DEBUG on level 2 in core.php A table will show at the bottom of the page with all your sql queries including a Took (ms) column. For total page execution - on DEBUG level 2 there is a comment rendered in the source with the execution time (right at the bottom) On Jun 28, 3:36 pm, hi and hello [EMAIL PROTECTED] wrote: I am using cakephp to build a website and at last I found the performance is not very well. So I want to know if it exits a tool by which I can get the execution time of PHP code and DB access? Or how can I write the tool ? thanks very much!!!- 隐藏被引用文字 - - 显示引用的文字 - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I get the execution time of PHP code and DB access?
Another solution which would not require any alteration to Cake would be to install the xdebug module to php and use it's profiling capabilities. This will generate a lot more info than you need, but will let you know where all the bottlenecks in your app are down to the line of code level. Simon On 28 Jun, 10:04, Geoff Ford [EMAIL PROTECTED] wrote: If you want to leverage what is already in cake you will need to modify some core files. In cake/libs/model/datasources/dbo_source.php in function execute() (around lines 277-280) you can manually log the query and time ($this- took) to a log file. Same in app/webroot/index.php for total execution time On Jun 28, 5:10 pm, hi and hello [EMAIL PROTECTED] wrote: Thank you, but there still exists a problem . Because I use AJAX in my website and return the data as JSON format, so I can not let cakephp append the debug infor to the response. And I want to read the the infor at a console or a log file? Can I do it? On 6月28日, 下午2时21分, Geoff Ford [EMAIL PROTECTED] wrote: For query times put DEBUG on level 2 in core.php A table will show at the bottom of the page with all your sql queries including a Took (ms) column. For total page execution - on DEBUG level 2 there is a comment rendered in the source with the execution time (right at the bottom) On Jun 28, 3:36 pm, hi and hello [EMAIL PROTECTED] wrote: I am using cakephp to build a website and at last I found the performance is not very well. So I want to know if it exits a tool by which I can get the execution time of PHP code and DB access? Or how can I write the tool ? thanks very much!!!- 隐藏被引用文字 - - 显示引用的文字 - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I get the execution time of PHP code and DB access?
Finally you can have ob_start(); $db = ConnectionManager::getDataSource('default'); $db-showLog(); $log_contents = ob_get_clean(); $this-log( $log_contents ); However, the showLog function is hardcoded to embed HTML styling if you are not running command line. It might be worth writing your own function somewhere to grab the $db-_queriesLog directly and output it how you like (then you won't have to worry about using the output buffer too). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I get the execution time of PHP code and DB access?
Yes, I rewrited the showLog function in 'dbo_source.php' and save the DB query infor into a file.It worked,ha,thanks. 2007/6/29, Grant Cox [EMAIL PROTECTED]: Finally you can have ob_start(); $db = ConnectionManager::getDataSource('default'); $db-showLog(); $log_contents = ob_get_clean(); $this-log( $log_contents ); However, the showLog function is hardcoded to embed HTML styling if you are not running command line. It might be worth writing your own function somewhere to grab the $db-_queriesLog directly and output it how you like (then you won't have to worry about using the output buffer too). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How can I get the execution time of PHP code and DB access?
I am using cakephp to build a website and at last I found the performance is not very well. So I want to know if it exits a tool by which I can get the execution time of PHP code and DB access? Or how can I write the tool ? thanks very much!!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---