php-timer

Utility class for timing

  • Owner: sebastianbergmann/php-timer
  • Platform:
  • License:: BSD 3-Clause "New" or "Revised" License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

phpunit/php-timer

CI Status
Type Coverage

Utility class for timing things, factored out of PHPUnit into a stand-alone component.

Installation

You can add this library as a local, per-project dependency to your project using Composer:

composer require phpunit/php-timer

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:

composer require --dev phpunit/php-timer

Usage

Basic Timing

use SebastianBergmann\Timer\Timer;

Timer::start();

// ...

$time = Timer::stop();
var_dump($time);

print Timer::secondsToTimeString($time);

The code above yields the output below:

double(1.0967254638672E-5)
0 ms

Resource Consumption Since PHP Startup

use SebastianBergmann\Timer\Timer;

print Timer::resourceUsage();

The code above yields the output below:

Time: 0 ms, Memory: 0.50MB

Main metrics

Overview
Name With Ownersebastianbergmann/php-timer
Primary LanguagePHP
Program languagePHP (Language Count: 1)
Platform
License:BSD 3-Clause "New" or "Revised" License
所有者活动
Created At2010-05-08 10:40:25
Pushed At2025-09-26 12:07:58
Last Commit At
Release Count31
Last Release Name8.0.0 (Posted on 2025-02-07 05:59:42)
First Release Name1.0.0 (Posted on 2010-05-08 16:43:30)
用户参与
Stargazers Count7.7k
Watchers Count19
Fork Count64
Commits Count463
Has Issues Enabled
Issues Count20
Issue Open Count0
Pull Requests Count14
Pull Requests Open Count0
Pull Requests Close Count8
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private