ackintosh/benchy

This package is abandoned and no longer maintained. No replacement package was suggested.

simple Benchmark tool

dev-master 2013-06-09 03:42 UTC

This package is auto-updated.

Last update: 2022-04-16 04:46:19 UTC


README

#Benchy Benchy is simple and pluggable benchmark tool.

The build status of the current master branch is tracked by Travis CI: Build Status

##Installation composer.json

{
    "require": {
        "ackintosh/benchy": "dev-master"
    }
}
$ php composer.phar install

##Usage

<?php
require_once 'vendor/autoload.php';

$reporter = Ackintosh\Benchy::run(function ($reporter) {

    // do something

    echo $reporter->time->elapsed() . PHP_EOL;

    // do something

    echo $reporter->time->elapsed() . PHP_EOL;

}, 1000); // runs 1,000 times.(default : 1 )

echo 'total : ' . $reporter->time->total() . PHP_EOL;
echo 'average : ' . $reporter->time->average() . PHP_EOL;

##Extending Benchy Create your sexy code in Ackintosh/Bechy/Marker directory.

Ackintosh/Benchy/Marker/Example.php

<?php
class Example extends AbstractMarker{
    public function hoge() {}
}
<?php
$reporter->example->hoge();

##Hook points

  • before
  • after
  • before_per_laps
  • after_per_laps
<?php
class Example extends AbstractMarker{
    // override
    public function before()
    {
        // runs before benchmarking
    }
}