2017 © Pedro Peláez
 

library timer

Simple timer.

image

weew/timer

Simple timer.

  • Thursday, July 21, 2016
  • by weew
  • Repository
  • 1 Watchers
  • 1 Stars
  • 992 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Simple timer

Build Status Code Quality Test Coverage Dependencies Version Licence, (*1)

Table of contents

Installation

composer require weew/timer, (*2)

Introduction

This very simple library can be used to benchmark execution times of your code, or simply whenever you need a stopwatch., (*3)

Basic usage

You can retrieve duration between the timer start and stop., (*4)

$timer = new Timer();
$timer->start();
sleep(1);
$timer->stop();
echo $timer->getDuration(); // 1.0234

Checkpoints

You can create custom checkpoints whenever and retrieve the elapsed time until the checkpoint was reached., (*5)

$timer = new Timer();
$timer->start();
$timer->createCheckpoint('foo');
$timer->stop();

$timer->getStartTime(); // returns start time in microseconds
$timer->getStopTime(); // returns stop time

$timer->getCheckpoint('start'); // returns start time
$timer->getCheckpoint('stop'); // returns stop time
$timer->getCheckpoint('foo'); // returns time of the checkpoint foo

Duration between checkpoints

You can measure duration between the checkpoints., (*6)

$timer = new Timer();
$timer->createCheckpoint('foo');
sleep(1);
$timer->createCheckpoint('bar');

// returns time elapsed since checkpoint foo till now
$timer->getDuration('foo');
// returns duration between checkpoints foo and bar
$timer->getDuration('foo', 'bar');

$timer->stop();
// returns time between checkpoints foo and stop
$timer->getDuration('foo');

The Versions

21/07 2016

dev-master

9999999-dev

Simple timer.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maxim Kott

21/07 2016

v1.0.1

1.0.1.0

Simple timer.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maxim Kott

16/11 2015

v1.0.0

1.0.0.0

Simple timer.

  Sources   Download

MIT

The Requires

  • weew/php-helpers-array ^1.0.0

 

The Development Requires

by Maxim Kott

30/10 2015

v0.0.5

0.0.5.0

Simple timer.

  Sources   Download

MIT

The Requires

  • weew/php-helpers-array 0.*

 

The Development Requires

by Maxim Kott

19/08 2015

v0.0.4

0.0.4.0

Simple timer.

  Sources   Download

MIT

The Requires

  • weew/php-helpers-array 0.*

 

The Development Requires

by Maxim Kott

18/08 2015

v0.0.3

0.0.3.0

Simple timer.

  Sources   Download

MIT

The Requires

  • weew/php-helpers-array ^0.0.2

 

The Development Requires

by Maxim Kott

12/08 2015

v0.0.2

0.0.2.0

Simple timer.

  Sources   Download

MIT

The Requires

  • weew/php-helpers-array ^0.0.2

 

The Development Requires

by Maxim Kott

12/08 2015

v0.0.1

0.0.1.0

Simple timer.

  Sources   Download

MIT

The Requires

  • weew/php-helpers-array ^0.0.2

 

The Development Requires

by Maxim Kott