PHP code example of mmdm / sim-benchmark

1. Go to this page and download the library: Download mmdm/sim-benchmark library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mmdm / sim-benchmark example snippets

 
composer 



// to instance a benchamrk object
$benchmark = new Benchmark();
$label = 'a label';

// start benchmark here
$benchmark->start($label);
// here you should write your algorithm
// ...
// now you can stop benchmark
$benchmark->stop($label);

//now you can see result like this
$benchmark->getReport($label);

$benchmark->start($label);

$benchmark->pause($label);

$benchmark->resume($label);

$benchmark->stop($label);

$time = $benchmark->getTime($label);

$memory = $benchmark->getMemory($label);

array [
    'time' => $time, // 2 microsecond(s), etc.
    'memory' => $memory // 10MiB, etc.
]

$res = $benchmark->get($label);

$benchmark->getReport($label);