PHPackages                             phpreboot/stopwatch - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpreboot/stopwatch

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phpreboot/stopwatch
===================

PHP utility library for Stopwatch. Useful for optimization and other purpose.

v1.0.2(9y ago)31.6k3MITPHP

Since Sep 26Pushed 9y agoCompare

[ Source](https://github.com/phpreboot/stopwatch)[ Packagist](https://packagist.org/packages/phpreboot/stopwatch)[ RSS](/packages/phpreboot-stopwatch/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

phpreboot/stopwatch
===================

[](#phprebootstopwatch)

[![Build Status](https://camo.githubusercontent.com/3ad26bd868a897b0919f9b78b3cf21f8c872a6ba586115ca07bfdc941b78e4cc/68747470733a2f2f7472617669732d63692e6f72672f7068707265626f6f742f73746f7077617463682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/phpreboot/stopwatch)[![HHVM Status](https://camo.githubusercontent.com/7186c325357b6978371b418b1f7b42fbee8057e151050add8787201295247e73/687474703a2f2f6868766d2e683463632e64652f62616467652f7068707265626f6f742f73746f7077617463682e7376673f7374796c653d666c6174)](http://hhvm.h4cc.de/package/phpreboot/stopwatch)[![Code Climate](https://camo.githubusercontent.com/aac9efd62a57a58f98fd2103179a1f9b620fa84424b14826f3eab077b768dd88/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7068707265626f6f742f73746f7077617463682f6261646765732f6770612e737667)](https://codeclimate.com/github/phpreboot/stopwatch)[![Test Coverage](https://camo.githubusercontent.com/16f696194f51d87ddfa7ac78e518ff928da07c021bc0794685a52d01b1fc054a/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7068707265626f6f742f73746f7077617463682f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/phpreboot/stopwatch/coverage)[![Software License](https://camo.githubusercontent.com/1a2e0606685ce00663bf829868f794fd3fc9c86f8d80cae324734129e0723a58/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e737667)](https://github.com/phpreboot/stopwatch/blob/master/LICENSE)[![Latest Version](https://camo.githubusercontent.com/9958e04a08792632440b82c909800dd6e25d02fcbc4a25ac07de2a70ad15b607/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068707265626f6f742f73746f7077617463682e737667)](https://packagist.org/packages/phpreboot/stopwatch)

[![SensioLabsInsight](https://camo.githubusercontent.com/be2b448c4a5bb4b159bd43fb3db959e959de76da37c7a63b5b9c2cd5e49841b2/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f63306262633139362d306366662d343336322d623238362d3966316233623763643434352f6269672e706e67)](https://insight.sensiolabs.com/projects/c0bbc196-0cff-4362-b286-9f1b3b7cd445)

Purpose
-------

[](#purpose)

While optimizations, we need to check time taken by different operations. This soon becomes ugly, if we put many `microtime` code blocks.

Purpose of StopWatch is to provide neat way of recording time taken by different blocks.

### Supported versions

[](#supported-versions)

Above build is tested code on PHP version 5.3, 5.4, 5.5, 5.6, 7.0 and HHVM. Check `.travis.yml` for details.

Examples
--------

[](#examples)

Examples are given in example folder. To quick view, below are few examples:

### Simple stopwatch (file example/simplewatch.php)

[](#simple-stopwatch-file-examplesimplewatchphp)

Following example show use of StopWatch in simplest form.

```
