App::plackbench - programmatic interface to plackbench
See plackbench for the command line tool.
my $bench = App::plackbench->new( psgi_path => $psgi_path, count => 5, uri => '/some/path', ); my $stats = $bench->run(); printf("Averaged %8.3f seconds over %d requests\n", $stats->mean(), $stats->count());
Class for executing requests on a Plack application and recording stats.
Defaults to a Plack app loaded from psgi_path, using "load_psgi" in Plack::Util.
Number of times to execute the request. Defaults to 1.
If true, an initial request will be made which won't be included in the stats. Defaults to false.
An arrayref of subroutine references to do any preprocessing of the request. Each subroutine reference will be called in order (though you shouldn't rely on that) and passed a reference to the HTTP::Request object.
Each sub will be called once for every unique request. Under a normal GET request, there will only be one unique request. However if "post_data" is being used there will be one unique request for request body.
The return value from the subs is ignored.
An arrayref of request bodies. If set, POST requests will be made instead of GET requests.
If multiple request bodies are set they will be rotated through. This can be useful, for instance, to cycle through possible values for a field.
The path to the Plack application to be tested.
The URI to request on the app.
new(%attributes)
Returns a new instance of App::plackbench. Any arguments will be used a attribute settings.
App::plackbench
run()
Executes the requests (using the current attribute settings), and returns an App::plackbench::Stats object. Takes no arguments.
add_fixup_from_file($file)
Evaluates $file and appends the returned subroutine reference to "fixups". If the file can't be parsed, or if it doesn't return a subroutine reference the method will die.
$file
https://github.com/pboyd/App-plackbench
Paul Boyd <boyd.paul2@gmail.com>
This software is copyright (c) 2014 by Paul Boyd.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
plackbench, Plack
To install App::plackbench, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::plackbench
CPAN shell
perl -MCPAN -e shell install App::plackbench
For more information on module installation, please visit the detailed CPAN module installation guide.