kanel/timer

There is no license information available for the latest version (1.0.0) of this package.

A simple PHP timer that allows to benchamrk the code

1.0.0 2017-04-01 23:20 UTC

This package is not auto-updated.

Last update: 2024-11-10 02:34:55 UTC


README

build

A simple Timer to benchmark functions or code execution duration

#How it works :

  • Start the timer

        Timer::start();     
    
  • Mark a place as a lap (the timer will continue counting time after returning the difference between the start and this lap)

        $duration = Timer::lap();
    

    where $duration is in milliseconds

  • If you want the duration between this lap and the last one, send this constant as a parameter:

        $duration = Timer::lap(Timer::FROM_LAST_LAP);
    
  • To stop the time and get the duration from the beginning (the start)

        $duration = Timer::stop();
    
  • To stop the time and get the duration from the last lap

        $duration = Timer::stop(Timer::FROM_LAST_LAP);