~ballot/wordpress/openstack-objectstorage-breaking-insight

« back to all changes in this revision

Viewing changes to vendor/phpunit/php-timer/README.md

  • Committer: Jacek Nykis
  • Date: 2015-02-11 15:35:31 UTC
  • Revision ID: jacek.nykis@canonical.com-20150211153531-hmy6zi0ov2qfkl0b
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# PHP_Timer
 
2
 
 
3
Utility class for timing things, factored out of PHPUnit into a stand-alone component.
 
4
 
 
5
## Installation
 
6
 
 
7
You can use the [PEAR Installer](http://pear.php.net/manual/en/guide.users.commandline.cli.php) or [Composer](http://getcomposer.org/) to download and install this package as well as its dependencies.
 
8
 
 
9
### PEAR Installer
 
10
 
 
11
The following two commands (which you may have to run as `root`) are all that is required to install this package using the PEAR Installer:
 
12
 
 
13
    pear config-set auto_discover 1
 
14
    pear install pear.phpunit.de/PHP_Timer
 
15
 
 
16
### Composer
 
17
 
 
18
To add this package as a local, per-project dependency to your project, simply add a dependency on `phpunit/php-timer` to your project's `composer.json` file. Here is a minimal example of a `composer.json` file that just defines a dependency on PHP_Timer:
 
19
 
 
20
    {
 
21
        "require": {
 
22
            "phpunit/php-timer": "*"
 
23
        }
 
24
    }
 
25
 
 
26
### Usage
 
27
 
 
28
#### Basic Timing
 
29
 
 
30
```php
 
31
PHP_Timer::start();
 
32
 
 
33
$timer->start();
 
34
 
 
35
// ...
 
36
 
 
37
$time = PHP_Timer::stop();
 
38
var_dump($time);
 
39
 
 
40
print PHP_Timer::secondsToTimeString($time);
 
41
```
 
42
 
 
43
The code above yields the output below:
 
44
 
 
45
    double(1.0967254638672E-5)
 
46
    0 ms
 
47
 
 
48
#### Resource Consumption Since PHP Startup
 
49
 
 
50
```php
 
51
print PHP_Timer::resourceUsage();
 
52
```
 
53
 
 
54
The code above yields the output below:
 
55
 
 
56
    Time: 0 ms, Memory: 0.50Mb