Public Member Functions | |
__construct ($name, callable $func, $unit=1.0) | |
T () | |
X () | |
Reset () | |
Pause () | |
Resume () | |
runTime () | |
loops () | |
Benchmark ($xhprof) | |
Data Fields | |
$n | |
$name | |
Benchmark is helper for you to write benchmark functions.
The benchmark function will receive a Fruit instance, you MUST use a for-loop to run your code for Fruit::N() times.
The benchmark function might be called several times, be sure to setup the environment properly, and clear it before exiting.
Definition at line 14 of file Benchmark.php.
__construct | ( | $name, | |
callable | $func, | ||
$unit = 1.0 |
|||
) |
Definition at line 27 of file Benchmark.php.
Benchmark | ( | $xhprof | ) |
Do the benchmark stuff.
Definition at line 127 of file Benchmark.php.
loops | ( | ) |
loop running per time unit
Definition at line 96 of file Benchmark.php.
Pause | ( | ) |
Temporary stop the timer.
Definition at line 66 of file Benchmark.php.
Reset | ( | ) |
Reset the internal timer.
If you have to do some stuff to setup the environment, and that costs some time, you can call this to reset the timer before really doing test stuff.
Definition at line 57 of file Benchmark.php.
Resume | ( | ) |
Resume the timer.
Definition at line 78 of file Benchmark.php.
runTime | ( | ) |
run time per loop (millisecond)
Definition at line 88 of file Benchmark.php.
T | ( | ) |
Get how much time costs to run N loops.
Definition at line 37 of file Benchmark.php.
X | ( | ) |
Get xhprof data (if any)
Definition at line 45 of file Benchmark.php.
$n |
Definition at line 16 of file Benchmark.php.
$name |
Definition at line 25 of file Benchmark.php.