diff --git a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php index 921dbdf880..9d441a2738 100644 --- a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php +++ b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php @@ -12,7 +12,7 @@ namespace Symfony\Bridge\Doctrine\Logger; use Symfony\Component\HttpKernel\Log\LoggerInterface; -use Symfony\Component\HttpKernel\Debug\Stopwatch; +use Symfony\Component\Stopwatch\Stopwatch; use Doctrine\DBAL\Logging\SQLLogger; /** diff --git a/src/Symfony/Bridge/Doctrine/composer.json b/src/Symfony/Bridge/Doctrine/composer.json index 325c335e3e..b65b8cbcd9 100644 --- a/src/Symfony/Bridge/Doctrine/composer.json +++ b/src/Symfony/Bridge/Doctrine/composer.json @@ -19,6 +19,9 @@ "php": ">=5.3.3", "doctrine/common": ">=2.2,<2.4-dev" }, + "require-dev": { + "symfony/stopwatch": "2.2.*" + }, "suggest": { "symfony/form": "2.2.*", "symfony/validator": "2.2.*", diff --git a/src/Symfony/Bridge/Propel1/Logger/PropelLogger.php b/src/Symfony/Bridge/Propel1/Logger/PropelLogger.php index 43211a034d..8e38f2418e 100644 --- a/src/Symfony/Bridge/Propel1/Logger/PropelLogger.php +++ b/src/Symfony/Bridge/Propel1/Logger/PropelLogger.php @@ -11,7 +11,7 @@ namespace Symfony\Bridge\Propel1\Logger; -use Symfony\Component\HttpKernel\Debug\Stopwatch; +use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\HttpKernel\Log\LoggerInterface; /** @@ -33,7 +33,7 @@ class PropelLogger protected $queries; /** - * @var \Symfony\Component\HttpKernel\Debug\Stopwatch + * @var Stopwatch */ protected $stopwatch; diff --git a/src/Symfony/Bridge/Propel1/composer.json b/src/Symfony/Bridge/Propel1/composer.json index b4fb61284a..3e9bdd3299 100644 --- a/src/Symfony/Bridge/Propel1/composer.json +++ b/src/Symfony/Bridge/Propel1/composer.json @@ -22,6 +22,9 @@ "symfony/form": "2.2.*", "propel/propel1": "1.6.*" }, + "require-dev": { + "symfony/stopwatch": "2.2.*" + }, "autoload": { "psr-0": { "Symfony\\Bridge\\Propel1\\": "" } }, diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml index 8885557a10..a1c332a6ab 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml @@ -6,7 +6,7 @@ Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher - Symfony\Component\HttpKernel\Debug\Stopwatch + Symfony\Component\Stopwatch\Stopwatch %kernel.cache_dir%/%kernel.container_class%.xml Symfony\Component\HttpKernel\Controller\TraceableControllerResolver diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index d61031eb58..3f2ad2f0c1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -23,6 +23,7 @@ "symfony/http-kernel": "2.2.*", "symfony/filesystem": "2.2.*", "symfony/routing": "2.2.*", + "symfony/stopwatch": "2.2.*", "symfony/templating": "2.2.*", "symfony/translation": "2.2.*", "doctrine/common": ">=2.2,<2.4-dev" diff --git a/src/Symfony/Bundle/TwigBundle/Debug/TimedTwigEngine.php b/src/Symfony/Bundle/TwigBundle/Debug/TimedTwigEngine.php index e428401faa..33178e70a8 100644 --- a/src/Symfony/Bundle/TwigBundle/Debug/TimedTwigEngine.php +++ b/src/Symfony/Bundle/TwigBundle/Debug/TimedTwigEngine.php @@ -14,7 +14,7 @@ namespace Symfony\Bundle\TwigBundle\Debug; use Symfony\Bundle\TwigBundle\TwigEngine; use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables; use Symfony\Component\Templating\TemplateNameParserInterface; -use Symfony\Component\HttpKernel\Debug\Stopwatch; +use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\Config\FileLocatorInterface; /** diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json index 3e05e854df..b65b8923bd 100644 --- a/src/Symfony/Bundle/TwigBundle/composer.json +++ b/src/Symfony/Bundle/TwigBundle/composer.json @@ -19,6 +19,9 @@ "php": ">=5.3.3", "symfony/twig-bridge": "2.2.*" }, + "require-dev": { + "symfony/stopwatch": "2.2.*" + }, "autoload": { "psr-0": { "Symfony\\Bundle\\TwigBundle\\": "" } }, diff --git a/src/Symfony/Component/HttpKernel/CHANGELOG.md b/src/Symfony/Component/HttpKernel/CHANGELOG.md index 19859f52a2..2186e76a9c 100644 --- a/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 2.2.0 ----- + * moved the Stopwatch classes to a new component * added TraceableControllerResolver * added TraceableEventDispatcher (removed ContainerAwareTraceableEventDispatcher) * added support for WinCache opcode cache in ConfigDataCollector diff --git a/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php index e3f29ae53a..f8de31cf07 100644 --- a/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php @@ -11,7 +11,7 @@ namespace Symfony\Component\HttpKernel\Controller; -use Symfony\Component\HttpKernel\Debug\Stopwatch; +use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\HttpFoundation\Request; /** diff --git a/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php b/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php index aa878bc84c..c6b5ef7436 100644 --- a/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php +++ b/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php @@ -11,7 +11,7 @@ namespace Symfony\Component\HttpKernel\Debug; -use Symfony\Component\HttpKernel\Debug\Stopwatch; +use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\HttpKernel\Log\LoggerInterface; use Symfony\Component\HttpKernel\Profiler\Profile; use Symfony\Component\HttpKernel\Profiler\Profiler; diff --git a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php index 2177f2bbb4..88318cc2e9 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php @@ -15,10 +15,10 @@ use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher; -use Symfony\Component\HttpKernel\Debug\Stopwatch; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Stopwatch\Stopwatch; class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json index 40f10b333b..a6cf81f10e 100644 --- a/src/Symfony/Component/HttpKernel/composer.json +++ b/src/Symfony/Component/HttpKernel/composer.json @@ -28,7 +28,8 @@ "symfony/dependency-injection": "2.2.*", "symfony/finder": "2.2.*", "symfony/process": "2.2.*", - "symfony/routing": "2.2.*" + "symfony/routing": "2.2.*", + "symfony/stopwatch": "2.2.*" }, "suggest": { "symfony/browser-kit": "2.2.*", diff --git a/src/Symfony/Component/Stopwatch/.gitattributes b/src/Symfony/Component/Stopwatch/.gitattributes new file mode 100644 index 0000000000..e742c9b351 --- /dev/null +++ b/src/Symfony/Component/Stopwatch/.gitattributes @@ -0,0 +1,2 @@ +Tests/ export-ignore +phpunit.xml.dist export-ignore diff --git a/src/Symfony/Component/Stopwatch/.gitignore b/src/Symfony/Component/Stopwatch/.gitignore new file mode 100644 index 0000000000..48b8bf9072 --- /dev/null +++ b/src/Symfony/Component/Stopwatch/.gitignore @@ -0,0 +1 @@ +vendor/ diff --git a/src/Symfony/Component/Stopwatch/LICENSE b/src/Symfony/Component/Stopwatch/LICENSE new file mode 100644 index 0000000000..cdffe7aebc --- /dev/null +++ b/src/Symfony/Component/Stopwatch/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2012 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/Symfony/Component/Stopwatch/README.md b/src/Symfony/Component/Stopwatch/README.md new file mode 100644 index 0000000000..601ce3224c --- /dev/null +++ b/src/Symfony/Component/Stopwatch/README.md @@ -0,0 +1,13 @@ +Stopwatch Component +=================== + +Stopwatch provides a way to profile code. + +Resources +--------- + +You can run the unit tests with the following command: + + $ cd path/to/Symfony/Component/Stopwatch/ + $ composer.phar install --dev + $ phpunit diff --git a/src/Symfony/Component/HttpKernel/Debug/Stopwatch.php b/src/Symfony/Component/Stopwatch/Stopwatch.php similarity index 99% rename from src/Symfony/Component/HttpKernel/Debug/Stopwatch.php rename to src/Symfony/Component/Stopwatch/Stopwatch.php index 7f2673d386..74483a7b2a 100644 --- a/src/Symfony/Component/HttpKernel/Debug/Stopwatch.php +++ b/src/Symfony/Component/Stopwatch/Stopwatch.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpKernel\Debug; +namespace Symfony\Component\Stopwatch; /** * Stopwatch provides a way to profile code. diff --git a/src/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php b/src/Symfony/Component/Stopwatch/StopwatchEvent.php similarity index 98% rename from src/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php rename to src/Symfony/Component/Stopwatch/StopwatchEvent.php index 82c463906f..a8146fe6f7 100644 --- a/src/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php +++ b/src/Symfony/Component/Stopwatch/StopwatchEvent.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpKernel\Debug; +namespace Symfony\Component\Stopwatch; /** * Represents an Event managed by Stopwatch. diff --git a/src/Symfony/Component/HttpKernel/Debug/StopwatchPeriod.php b/src/Symfony/Component/Stopwatch/StopwatchPeriod.php similarity index 97% rename from src/Symfony/Component/HttpKernel/Debug/StopwatchPeriod.php rename to src/Symfony/Component/Stopwatch/StopwatchPeriod.php index f920e8dedb..221ee792f7 100644 --- a/src/Symfony/Component/HttpKernel/Debug/StopwatchPeriod.php +++ b/src/Symfony/Component/Stopwatch/StopwatchPeriod.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpKernel\Debug; +namespace Symfony\Component\Stopwatch; /** * Represents an Period for an Event. diff --git a/src/Symfony/Component/HttpKernel/Tests/Debug/StopwatchEventTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php similarity index 97% rename from src/Symfony/Component/HttpKernel/Tests/Debug/StopwatchEventTest.php rename to src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php index a739bc8a73..f4e3cd7f86 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Debug/StopwatchEventTest.php +++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php @@ -9,9 +9,9 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpKernel\Tests\Debug; +namespace Symfony\Component\Stopwatch\Tests; -use Symfony\Component\HttpKernel\Debug\StopwatchEvent; +use Symfony\Component\Stopwatch\StopwatchEvent; /** * StopwatchEventTest diff --git a/src/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php similarity index 88% rename from src/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php rename to src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php index 210acb5959..8a77d8a0aa 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php +++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php @@ -9,9 +9,9 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpKernel\Tests\Debug; +namespace Symfony\Component\Stopwatch\Tests; -use Symfony\Component\HttpKernel\Debug\Stopwatch; +use Symfony\Component\Stopwatch\Stopwatch; /** * StopwatchTest @@ -25,7 +25,7 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase $stopwatch = new Stopwatch(); $event = $stopwatch->start('foo', 'cat'); - $this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event); + $this->assertInstanceof('Symfony\Component\Stopwatch\StopwatchEvent', $event); $this->assertEquals('cat', $event->getCategory()); } @@ -36,7 +36,7 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase usleep(20000); $event = $stopwatch->stop('foo'); - $this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event); + $this->assertInstanceof('Symfony\Component\Stopwatch\StopwatchEvent', $event); $total = $event->getTotalTime(); $this->assertTrue($total > 10 && $total <= 29, $total.' should be 20 (between 10 and 29)'); } @@ -50,7 +50,7 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase usleep(10000); $stopwatch->stop('foo'); - $this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event); + $this->assertInstanceof('Symfony\Component\Stopwatch\StopwatchEvent', $event); $total = $event->getTotalTime(); $this->assertTrue($total > 10 && $total <= 29, $total.' should be 20 (between 10 and 29)'); } diff --git a/src/Symfony/Component/Stopwatch/composer.json b/src/Symfony/Component/Stopwatch/composer.json new file mode 100644 index 0000000000..30336fc65c --- /dev/null +++ b/src/Symfony/Component/Stopwatch/composer.json @@ -0,0 +1,31 @@ +{ + "name": "symfony/stopwatch", + "type": "library", + "description": "Symfony Stopwatch Component", + "keywords": [], + "homepage": "http://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.3" + }, + "autoload": { + "psr-0": { "Symfony\\Component\\Stopwatch\\": "" } + }, + "target-dir": "Symfony/Component/Stopwatch", + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + } +} diff --git a/src/Symfony/Component/Stopwatch/phpunit.xml.dist b/src/Symfony/Component/Stopwatch/phpunit.xml.dist new file mode 100644 index 0000000000..d3b5ba7cea --- /dev/null +++ b/src/Symfony/Component/Stopwatch/phpunit.xml.dist @@ -0,0 +1,29 @@ + + + + + + ./Tests/ + + + + + + ./ + + ./Tests + ./vendor + + + +