2017 © Pedro Peláez
 

library stop-watch

StopWatch is a PHP class for precise time measurement. This package is part of the ATK14 Framework.

image

atk14/stop-watch

StopWatch is a PHP class for precise time measurement. This package is part of the ATK14 Framework.

  • Friday, December 1, 2017
  • by yarri
  • Repository
  • 2 Watchers
  • 0 Stars
  • 804 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 10 % Grown

The README.md

StopWatch

A PHP class for precise time measurement., (*1)

Basic usage

$s = new StopWatch();

$s->start();
// do something...
$s->stop(); 

// printing result
echo $s->getResult(); // (float) 3.6618700027466
// or
echo $s; // to string conversion provides humanized output, e.g. "0:03.662"

Usual usage

$s = new StopWatch();

$s->start("total");

  $s->start("parsing_request");
  // do something
  $s->stop("parsing_request");

  $s->start("preparing_data");
  // do something
  $s->stop("preparing_data");

  $s->start("rendering");

    // do something

    $s->start("rendering_partial_template");
    // do something
    $s->stop("rendering_partial_template");

    $s->start("rendering_partial_template");
    // do something
    $s->stop("rendering_partial_template");

  $s->stop("rendering");

$s->stop("total");

Print results, (*2)

echo $s->getResult("total"); // 0.034516096115112
echo $s->getResult("rendering"); // 0.017526865005493

For overal report there is a special method, (*3)

echo $s->getPrintableOutput();

The output is pretty cool :), (*4)

                     total:  0.034516
           parsing_request:  0.004428
            preparing_data:  0.003821
                 rendering:  0.017527
rendering_partial_template:  0.003695
rendering_partial_template:  0.003743
          ----------------: total
                     total x 1:    0.0345s
           parsing_request x 1:    0.0044s
            preparing_data x 1:    0.0038s
                 rendering x 1:    0.0175s
rendering_partial_template x 2:    0.0074s

The Versions

01/12 2017

dev-master

9999999-dev https://github.com/atk14/StopWatch

StopWatch is a PHP class for precise time measurement. This package is part of the ATK14 Framework.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

string

01/12 2017

v0.1

0.1.0.0 https://github.com/atk14/StopWatch

StopWatch is a PHP class for precise time measurement. This package is part of the ATK14 Framework.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

string