dev-master
9999999-dev https://github.com/urodoz/execution-statsThis bundle logs the time execution of methods, and supply stats data.
MIT
The Requires
- php >=5.3.2
- symfony/framework-bundle >=2.1.0
log symfony timer performance stats jenkins
This bundle logs the time execution of methods, and supply stats data.
Service to handle progress of time execution of service and methods in your Symfony2 application, (*1)
On the composer.json file add :, (*2)
``` json, (*3)
"require": { "urodoz/execution-stats": "dev-master", }
Run composer update
php composer.phar update, (*4)
Add the bundle to the *AppKernel.php* ``` php <?php $bundles = array( new Urodoz\TimeExecutionStatsBundle\UrodozTimeExecutionStatsBundle(); );
You can add the bundle only in dev and test environment as follows, (*5)
``` php, (*6)
if (in_array($this->getEnvironment(), array('dev', 'test'))) { //Adding bundle to dev and test environments $bundles[] = new Urodoz\TimeExecutionStatsBundle\UrodozTimeExecutionStatsBundle(); }
Update the *Doctrine* schema (you can use --dump-sql option before to check the SQL executed). The tracking time data is stored on a log table inside your data model.
php app/console doctrine:schema:update --force, (*7)
Usage as Symfony 2 service -------------------------- You can access now to the time tracking service **urodoz.timeTracker**. The parameters to track a service are : * Name : Name (unique) of the tracking item * Tag : Used to group results * Version : The version of the service. Can be a generic parameter setted for all platform. The graphs will show the progression of performance between different versions. Example of tracking : ``` php protected function doSomeTask() { //Head of the method if($this->getContainer()->has("urodoz.timeTracker")) { $this->get('urodoz.timeTracker')->start( "user.doSomeTask", "UserBundle", $this->container->getParameter("appVersion")); } ... //code ... if($this->getContainer()->has("urodoz.timeTracker")) { $this->get('urodoz.timeTracker')->stop("user.doSomeTask"); } }
Once the bundle has been installed. You have access to 3 new commands on your app/console :, (*8)
php app/console urodoz:statsbundle:pack
Will pack the data on database, (*9)
php app/console urodoz:statsbundle:ranking
Show the slower tracking methods or services , optionally grouped by tags, (*10)
php app/console urodoz:statsbundle:show
Show data of performance improve, referenced from the last versions of a single service. Here you can see how the service has progressd into different versions in execution time, (*11)
Currenty on development, (*12)
Currenty on development, (*13)
This bundle logs the time execution of methods, and supply stats data.
MIT
log symfony timer performance stats jenkins