kanel/benchmark

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

Benchmark your code by tracking duration and memory usage of your code

Maintainers

Package info

github.com/elkaadka/Benchmark

pkg:composer/kanel/benchmark

Statistics

Installs: 20

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2017-04-02 20:37 UTC

This package is not auto-updated.

Last update: 2026-03-01 09:32:46 UTC


README

build

A simple tool to benchmark time execution and memory usage

#How it works :

  • Start the benchmarkg

        Benchmark::start();     
    
  • Mark a place as a lap (the benchmark will continue)

        $usage = Benchmark::lap();
    

    where $usage is an array :

     [
         'time'   => ...,
         'memory' => ...,
     ]
    
  • If you want the benchmark between the two last laps, send the following parameter:

        $usage = Benchmark::lap(Benchmark::FROM_LAST_LAP);
    
  • To stop the Benchmark and get the time/memory from the beginning (the start)

        $usage = Benchmark::stop();
    
  • To stop the Benchmark tracking and get the memory used and duration from the last lap

        $usage = Benchmark::stop(Benchmark::FROM_LAST_LAP);
    
  • To get the Benchmark history

        $usage = Benchmark::getHistory();