guessCount() 공개 메소드

Average the guessCount of each test, determining the best n
public guessCount ( float $max_seconds ) : integer
$max_seconds float
리턴 integer
예제 #1
0
<?php

use Lavoiesl\PhpBenchmark\Benchmark;
require_once '_autoload.php';
$benchmark = new Benchmark();
// @link http://www.php.net/manual/en/control-structures.declare.php#control-structures.declare.ticks
declare (ticks=1);
$benchmark->add('1024 * 256', function () {
    return str_repeat('a', 1024 * 256);
});
$benchmark->add('1024 * 1024', function () {
    return str_repeat('a', 1024 * 1024);
});
$benchmark->add('1024 * 1024 * 16', function () {
    return str_repeat('a', 1024 * 1024 * 16);
});
$benchmark->guessCount(2);
// aim for 2 seconds per test (default)
$benchmark->run();