benchmarks: Add setup, bench naming, and custom count default
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 19 Apr 2017 23:22:50 +0000 (16:22 -0700)
committerTim Starling <tstarling@wikimedia.org>
Thu, 20 Apr 2017 04:49:36 +0000 (04:49 +0000)
commitdcc8b7e4cee8c08a6bce8f795ebf1b07cece73e6
treed711fadbd5fe31344bdfadbb7c4f0ecafac99514
parent27822f0fa14159dfc71ff0b6e1d994692cf4ed60
benchmarks: Add setup, bench naming, and custom count default

* bench(): Add support for setup function.
  Demonstrated by converting bench_delete_truncate.php to use Benchmarker.

* bench(): Allow benchmarks to be named. Default remains (fn + args).
  Useful for closures.

* Benchmarker: Support overriding the default count of 100.
  Demonstrated in bench_delete_truncate.php to run 10x instead of
  100x (previous: 1x).

Change-Id: Iac182eaf3053f5bf0e811cd23082f530629d8a4e
maintenance/benchmarks/Benchmarker.php
maintenance/benchmarks/bench_delete_truncate.php