2017 © Pedro Peláez
 

library timer

Simply helps record performance during app execution.

image

myth/timer

Simply helps record performance during app execution.

  • Friday, July 3, 2015
  • by lonnieezell
  • Repository
  • 3 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

myth:Timer

Build Status, (*1)

Timer is a tiny utility class that allows you benchmark execution time and memory usage within your PHP applications., (*2)

Installation

Installation is done through Composer., (*3)

composer require myth/timer

Usage

Recording the Time

To determine the elapsed time that an action took, you must call the Timer start() and stop() methods at the beginning and end of the action, respectively. The only parameter is a name you want to refer to this timer by. This is required., (*4)

$timer = new Myth\Timer\Timer;
$timer->start('my_action');
// Do something here...
$timer->stop('my_action');

Retrieving the Time

You can retrieve the benchmark information either as an array with all of the data, or as a formatted string., (*5)

To get the raw data, use the get() method. The only parameter is the name of the timer., (*6)

    $timer->get('my_action');
    // Returns: 
    array(
        'start_time'    =>
        'stop_time' =>
        'avg_time'      =>
        'start_memory'  => 
        'stop_memory'   => 
        'avg_memory'    => 
        'peak_memory'   =>
    );

To retrieve a performance string, use the output() method., (*7)

$timer->output('my_action');
// Returns: [my_action] 0.0011 seconds, 0.00MB memory (4.50MB peak)

The Versions

03/07 2015

dev-master

9999999-dev https://github.com/newmythmedia/timer

Simply helps record performance during app execution.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

php benchmark