Projekt

Obecné

Profil

Stáhnout (1022 Bajtů) Statistiky
| Větev: | Revize:
1 cb15593b Cajova-Houba
[![Build Status](https://travis-ci.org/sebastianbergmann/php-timer.svg?branch=master)](https://travis-ci.org/sebastianbergmann/php-timer)
2
3
# PHP_Timer
4
5
Utility class for timing things, factored out of PHPUnit into a stand-alone component.
6
7
## Installation
8
9
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
10
11
    composer require phpunit/php-timer
12
13
If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
14
15
    composer require --dev phpunit/php-timer
16
17
## Usage
18
19
### Basic Timing
20
21
```php
22
PHP_Timer::start();
23
24
// ...
25
26
$time = PHP_Timer::stop();
27
var_dump($time);
28
29
print PHP_Timer::secondsToTimeString($time);
30
```
31
32
The code above yields the output below:
33
34
    double(1.0967254638672E-5)
35
    0 ms
36
37
### Resource Consumption Since PHP Startup
38
39
```php
40
print PHP_Timer::resourceUsage();
41
```
42
43
The code above yields the output below:
44
45
    Time: 0 ms, Memory: 0.50MB