<commit_before># phpreboot/stopwatch [![Build Status](https://travis-ci.org/phpreboot/stopwatch.svg?branch=master)](https://travis-ci.org/phpreboot/stopwatch) [![Code Climate](https://codeclimate.com/github/phpreboot/stopwatch/badges/gpa.svg)](https://codeclimate.com/github/phpreboot/stopwatch) [![Test Coverage](https://codeclimate.com/github/phpreboot/stopwatch/badges/coverage.svg)](https://codeclimate.com/github/phpreboot/stopwatch/coverage)

## Code climate report

[https://codeclimate.com/github/phpreboot/stopwatch](https://codeclimate.com/github/phpreboot/stopwatch)

## 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.

## Examples

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

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

Following example show use of StopWatch in simplest form.

```php
<?php

/*
 * This example shows simple use of Stopwatch. For simple use, we need just four steps:
 *   - Create instance of StopWatch,
 *   - Call `start()` method to start the timer,
 *   - Call `stop()` method to stop the watch, and
 *   - Call `getTime()` method to get the time between start and stop.
 */

// Load Composer auto loader
require_once "../vendor/autoload.php";

use Phpreboot\Stopwatch\StopWatch;

// Create an instance of StopWatch
$stopWatch = new StopWatch();

// Start the watch to start timer,
$stopWatch->start();<commit_msg>Removed code coverage link (badge are there) and added supported versions.<commit_after># phpreboot/stopwatch [![Build Status](https://travis-ci.org/phpreboot/stopwatch.svg?branch=master)](https://travis-ci.org/phpreboot/stopwatch) [![Code Climate](https://codeclimate.com/github/phpreboot/stopwatch/badges/gpa.svg)](https://codeclimate.com/github/phpreboot/stopwatch) [![Test Coverage](https://codeclimate.com/github/phpreboot/stopwatch/badges/coverage.svg)](https://codeclimate.com/github/phpreboot/stopwatch/coverage)

## 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

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 are given in example folder. To quick view, below are few examples:

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

Following example show use of StopWatch in simplest form.

```php
<?php

/*
 * This example shows simple use of Stopwatch. For simple use, we need just four steps:
 *   - Create instance of StopWatch,
 *   - Call `start()` method to start the timer,
 *   - Call `stop()` method to stop the watch, and
 *   - Call `getTime()` method to get the time between start and stop.
 */

// Load Composer auto loader
require_once "../vendor/autoload.php";

use Phpreboot\Stopwatch\StopWatch;

// Create an instance of StopWatch
$stopWatch = new StopWatch();

// Start the watch to start timer,
$stopWatch->start();
{'fraction_non_alphanumeric': 0.11945392491467577, 'fraction_numerical': 0.003102699348433137, 'mean_word_length': 4.501706484641638, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2512022', 'n_tokens_mistral': 990, 'n_tokens_neox': 958, 'n_words': 320}