start() public méthode

Sets start microtime
public start ( ) : void
Résultat void
Exemple #1
0
function testing(Ubench $bench, $requestURI)
{
    $_SERVER['REQUEST_URI'] = $requestURI;
    echo "\n----------------\ntesting for url: [" . $_SERVER['REQUEST_URI'] . "]\n";
    echo "bench gymadarasz/router\n";
    $bench->start();
    gymadarasz_router();
    $bench->end();
    echo "time:\t" . $bench->getTime() . ' (' . $bench->getTime(true) . ')' . PHP_EOL;
    echo "mem:\t" . $bench->getMemoryUsage() . PHP_EOL;
    echo "\nbench nikic/fast-route\n";
    $bench->start();
    nikic_fast_route();
    $bench->end();
    echo "time:\t" . $bench->getTime() . ' (' . $bench->getTime(true) . ')' . PHP_EOL;
    echo "mem:\t" . $bench->getMemoryUsage() . PHP_EOL;
}
Exemple #2
0
 public function testGetMemoryUsage()
 {
     $bench = new Ubench();
     $bench->start();
     $bench->end();
     $this->assertRegExp('/^[0-9.]+Mb/', $bench->getMemoryUsage());
     $this->assertInternalType('integer', $bench->getMemoryUsage(true));
     $this->assertRegExp('/^[0-9]+Mb/', $bench->getMemoryUsage(false, '%d%s'));
 }
<?php

/**
 * This file is part of Cartesian Product.
 *
 * (c) Marco Garofalo <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Nerd\CartesianProduct\CartesianProduct;
require __DIR__ . '/../vendor/autoload.php';
$bench = new Ubench();
$cartesianProduct = new CartesianProduct();
$cartesianProduct->appendSet(array('a', 'b', 'c'))->appendSet(array('d', 'e'))->appendSet(array('f', 'g', 'h'))->appendSet(array('i', 'j'))->appendSet(array('k', 'l'))->appendSet(array('m', 'n'))->appendSet(array('o'))->appendSet(array('p'))->appendSet(array('q', 'r', 's', 't'))->appendSet(array('u', 'v', 'w'))->appendSet(array('x', 'y'))->appendSet(array('z'));
$bench->start();
foreach ($cartesianProduct as $index => $product) {
    printf("[%s] (%s)\n", $index, implode(',', $product));
}
$bench->end();
printf("Time elapsed: %s\n", $bench->getTime());
printf("Memory footprint: %s\n", $bench->getMemoryPeak());
 public function appStart()
 {
     $this->bench = new Ubench();
     $this->bench->start();
 }