triplei/timer

A simple code execution timing class

Maintainers

Details

github.com/triplei/timer

Source

Issues

Installs: 90

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/triplei/timer

1.0.0 2016-09-15 22:11 UTC

This package is not auto-updated.

Last update: 2025-12-07 02:03:44 UTC


README

a simple timer class for php code performance testing

Example

use TripleI\Timer\Timer;

// start the timer
Timer::start();

/* some expensive code here */
// let's see how long it took to execute
Timer::tick('did some fancy stuff');

/* more expensive code here */
// let's see how long it was since the timer initially started
Timer::tick('did more fancy stuff');

// more code to time here. This time we will output a relative timestamp since the last ::tick() as well
Timer::tick('relative timer', true);

// output the end timing
Timer::done();

sample output

0.27108597755432 - did some fancy stuff
0.47066617012024 - did more fancy stuff
0.84685397148132 - (0.37618780136108) relative timer
0.84687614440918 - Done