This package is part of Fruit Framework.
BenchKit is set of tools helping you benchmark your program.
See mybench.php
in example
folder.
A benchmark test must be function or public method. It must receive only one parameter with type-hinting.
Benchmarks are grouped by their class. So it's suggested to put different group of benchmarks into different files.
Benchmark function are collected into an unnamed group.
bench
is command line benchmark runner. It will scan specified directory recursivly, find out all benchmark functions, and run. For example:
bench run example
Thanks to CLIFramework, you can run bench help run
to see supported command line arguments.
bench
does not support construct arguments, you have to write your own benchmark executor to register benchmarks and run it.
You can gather xhprof data when running benchmarks with default command line runner by
- enable
--xhprof
option and - use
Fruit\BenchKit\Formatter\XhprofSummary
summary formatter.
You can pass a string as constructor argument to formatter with --sa
and --pa
options.
Use Fruit\BenchKit\Formatter\ChainSummary
, and pass constructor argument to specify what formatters you want.
bench run -s 'Fruit\BenchKit\Formatter\ChainSummary' --sa '{"chain":["Fruit\\BenchKit\\Formatter\\HighChartSummary":"{\"type\":\"time\"}", "Fruit\\BenchKit\\Formatter\\XhprofSummary":""]}' -p 'Fruit\BenchKit\Formatter\NullProgressLogger' example > /tmp/chart.html
Beware about shell escaping and php string escaping because builtin formatters accepts argument in JSON format. Use --argdebug
when in doubt.
Any version of MIT, GPL or LGPL.