2017 © Pedro Pelรกez
 

library timer

Simple class for logging time and memory usage of stuff

image

geekality/timer

Simple class for logging time and memory usage of stuff

  • Wednesday, May 15, 2013
  • by Svish
  • Repository
  • 2 Watchers
  • 12 Stars
  • 9,312 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

Introduction

Simple class for logging time and memory usage of methods and such., (*1)

The Timer::__toString() method will create a simple plain text overview, but you can of course also create your own output by using the properties of the Timer objects directly., (*2)

Installation

If you use Composer, which I highly recommend, simply add the following dependency to your composer.json:, (*3)

    "require":
    {
        "geekality/timer": "1.*"
    },

Otherwise just download the file Timer.php from here and include it in your project. It's self-contained so you only need this one file., (*4)

Example usage

Timer::start('root');
// Stuff
Timer::start('section');
// Sub section stuff
Timer::stop();
// More stuff
echo Timer::result();

Here is some sample output from the sample/add.php script in this repo., (*5)

/TimerPHP/sample/add.php(3, 9)
 โ”‚ 
 โ”‚ 7.001 s
 โ”‚ 4.02 KiB, 732.41 KiB
 โ”‚ 
 โ”œ SlowMath::slowAdd(3, 9)
 โ”‚  โ”‚ 
 โ”‚  โ”‚ 4.001 s
 โ”‚  โ”‚ 432.00 B, 732.41 KiB
 โ”‚ โ”€โ”˜ 
 โ”‚ 
 โ”œ test(null, true, false)
 โ”‚  โ”‚ 
 โ”‚  โ”‚ 2.000 s
 โ”‚  โ”‚ 176.00 B, 732.41 KiB
 โ”‚ โ”€โ”˜ 

If you want to see some more extensive use of this class, you can check out my project, Svish/MyHymnal. There I also dump the result to a file which you can load on the website by clicking a tiny Debug link in the bottom right corner., (*6)

License

This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit Creative Commons Attribution 3.0 Unported License., (*7)

Creative Commons License, (*8)

The Versions

15/05 2013

v1.2

1.2.0.0 https://github.com/Svish/TimerPHP

Simple class for logging time and memory usage of stuff

  Sources   Download

CC-BY

The Requires

  • php >=5.3.0

 

statistics timer benchmark benchmarking

01/05 2013

dev-master

9999999-dev https://github.com/Svish/TimerPHP

Simple class for logging time and memory usage of stuff

  Sources   Download

CC-BY

The Requires

  • php >=5.3.0

 

statistics timer benchmark benchmarking

07/04 2013

v1.1.1

1.1.1.0 https://github.com/Svish/TimerPHP

Simple class for logging time and memory usage of stuff

  Sources   Download

CC-BY

The Requires

  • php >=5.3.0

 

statistics timer benchmark benchmarking

07/04 2013

v1.1

1.1.0.0 https://github.com/Svish/TimerPHP

Simple class for logging time and memory usage of stuff

  Sources   Download

CC-BY

The Requires

  • php >=5.3.0

 

statistics timer benchmark benchmarking

07/04 2013

v1.0

1.0.0.0 https://github.com/Svish/TimerPHP

Simple class for logging time and memory usage of stuff

  Sources   Download

CC-BY

The Requires

  • php >=5.3.0

 

statistics timer benchmark benchmarking