PHP code example of rkistaps / benchmark

1. Go to this page and download the library: Download rkistaps/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/ */

    

rkistaps / benchmark example snippets




use rkistaps\benchmark\Benchmark;

();

// do some heavy processing

$result = $bench->end();

echo $result->getReadableTime(); // Output: 2 secs



use rkistaps\benchmark\Benchmark;

t('outter');
// do some heavy processing

$bench->start('inner');
// process inner task

$innerResult = $bench->end('inner');
$outterResult = $bench->end('outter');

echo $innerResult->getReadableTime(); // Output inner time: 2 secs
echo $outterResult->getReadableTime(); // Output total time: 4 secs