urodoz / execution-stats
This bundle logs the time execution of methods, and supply stats data.
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
- symfony/framework-bundle: >=2.1.0
This package is not auto-updated.
Last update: 2024-12-15 05:31:40 UTC
README
Service to handle progress of time execution of service and methods in your Symfony2 application
Installation on Symfony with Composer
On the composer.json file add :
"require": { "urodoz/execution-stats": "dev-master", }
Run composer update
php composer.phar update
Add the bundle to the AppKernel.php
<?php $bundles = array( new Urodoz\TimeExecutionStatsBundle\UrodozTimeExecutionStatsBundle(); );
You can add the bundle only in dev and test environment as follows
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
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 :
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"); } }
See tracking data on Symfony 2 commands
Once the bundle has been installed. You have access to 3 new commands on your app/console :
php app/console urodoz:statsbundle:pack
Will pack the data on database
php app/console urodoz:statsbundle:ranking
Show the slower tracking methods or services , optionally grouped by tags
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
See tracking data generated on HTML
Currenty on development
Integrate tracking data into Jenkins application
Currenty on development