Sunday, 15 May 2011

php - How to get doctrine query stats from Symfony2 during page load -


I want to add some state to the footer of the page on the lines of 184ms / 6 / 10ms'.

Where 184 MMS pages are time-generation, 6 queries are counted and 10 dB is the time taken for the questions.

I can do the job of page generation, but how can I obtain database statistics outside of theory?

This will happen when AP is running in the course of environment, when I applaud in app_devi, perhaps there is a way to get it because symphony profiler is running.

Any help would be appreciated.

You can do this by using the Debugstak object

For example:

  $ principle = $ this-> Receive  

'theory'); $ Principle = connection = $ principle- & gt; Mill connections (); $ Stack = new \ Doctrine \ DBAL \ logging \ DebugStack (); $ DoctrineConnection-> GetConfiguration () - & gt; SetSQLLogger ($ stack); $ Em = $ principle- & gt; GetManager (); ... // query var_dump ($ stack); Var dump of $ Stack example:

  Principle \ DBAL \ logging \ debugastack object ([queries] => Array ([1] => array ([sql] => gt; ; SELECT t0.id Test T [Paramus] = & gt; Array () [type] = & gt; Array () [execution MS] => 0.00018191337585449) from [1] [2] = & gt; Array ([sql] = & gt; SELECT t0.id test t [params] = & gt; array () [type] => ery () [execution ms] => 0.00016307830810547 from AS id 1 ) [Enabled] => 1 [start] => 1426590420.2278 [current paper] => 2)  

No comments:

Post a Comment