Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

ServerGrove Blog:
Symfony2 components overview: Stopwatch
Mar 17, 2015 @ 16:12:40

The ServerGrove blog has returned with another of their overviews of a specific Symfony2 component. In this new article they talk about the Stopwatch component, a useful way to help in profiling execution of your application.

It’s been a long wait, but we are back again with the Symfony2 components series. In the 12th post of the series, we cover the Stopwatch component. Even though is one of the smallest ones, that does not mean is not important, as plays a crucial role when we want to profile our code.

Since the article series is about working with the component individually, they show you how to get it installed via Composer by itself. They include a simple example of it in use, starting/stopping a "test" timer, getting the duration and getting the overall memory consumption. They also include a slightly more complex example timing the execution of a Fibonacci sequence, reporting back the execution time on each line of output. The article also covers other features like the "lap" method, sections for grouping events and the difficulties you'd have extending it.

tagged: symfony2 component overview stopwatch introduction

Link: http://blog.servergrove.com/2015/03/16/symfony2-components-overview-stopwatch/


Trending Topics: