Fruit BenchKit
Benchmark helper
 All Data Structures Namespaces Files Functions Variables
Public Member Functions
Benchmarker Class Reference

Public Member Functions

 __construct ($ttl=1.0, $xhprof=false)
 
 register (callable $func)
 
 run (Summary $sum, Progress $pro)
 

Detailed Description

This is a helper for benchmarking your application.

You can register your benchmark function to it, then run the run() method.

See also
Fruit::register()
Fruit::run()

Definition at line 22 of file Benchmarker.php.

Constructor & Destructor Documentation

__construct (   $ttl = 1.0,
  $xhprof = false 
)

Definition at line 28 of file Benchmarker.php.

Member Function Documentation

register ( callable  $func)

Register a benchmark function.

The benchmark function has following restrictions:

  • Receive exactly one parameter, which will be an instance of Fruit
  • "Class::StaticMethod" format is not acceptable. Use array format instead.
  • Must have type-hinting.
Parameters
$funccallable
Returns
boolean true on success, false otherwise

Definition at line 88 of file Benchmarker.php.

run ( Summary  $sum,
Progress  $pro 
)

Run all benchmarks.

Parameters
$formattercallable to format the benchmark result. The formatter will receive registered function, loops it run, and time it costs.
Returns
an associative array maps the benchmark function to their benchmark result.

Definition at line 117 of file Benchmarker.php.


The documentation for this class was generated from the following file: