App::BencherUtils - Utilities related to bencher
This document describes version 0.243 of App::BencherUtils (from Perl distribution App-BencherUtils), released on 2021-01-20.
This distribution includes several utilities:
bencher-code
bencher-for
bencher-module-startup-overhead
chart-bencher-result
cleanup-old-bencher-results
format-bencher-result
gen-bencher-scenario-from-cpanmodules
list-bencher-results
list-bencher-scenario-modules
Usage:
bencher_code(%args) -> [status, msg, payload, meta]
Accept a list of codes and perform benchmark.
% bencher-code 'code1' 'code2'
is basically a shortcut for creating a scenario like this:
{ participants => [ {code_template=>'code1'}, {code_template=>'code2'}, ], }
and running that scenario with bencher.
bencher
This function is not exported.
Arguments ('*' denotes required arguments):
codes* => array[str]
precision => float
startup => bool (default: 0)
Use code_startup mode instead of normal benchmark.
with_process_size => bool
Returns an enveloped result (an array).
First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
Return value: (any)
bencher_for(%args) -> [status, msg, payload, meta]
List distributions that benchmarks specified modules.
This utility consults lcpan (local indexed CPAN mirror) to check if there are distributions that benchmarks a specified module. This is done by checking the presence of a dependency with the relationship x_benchmarks.
x_benchmarks
modules* => array[perl::modname]
bencher_module_startup_overhead(%args) -> [status, msg, payload, meta]
Accept a list of module names and perform startup overhead benchmark.
% bencher-module-startup-overhead Mod1 Mod2 Mod3
{ module_startup => 1, participants => [ {module=>"Mod1"}, {module=>"Mod2"}, {module=>"Mod3"}, ], }
To specify import arguments, you can use:
% bencher-module-startup-overhead Mod1 Mod2=arg1,arg2
which will translate to this Bencher scenario:
{ module_startup => 1, participants => [ {module=>"Mod1"}, {module=>"Mod2", import_args=>'arg1,arg2'}, ], }
modules* => array[perl::modargs]
chart_bencher_result(%args) -> [status, msg, payload, meta]
Generate chart of bencher result and display it.
json* => str
JSON data.
cleanup_old_bencher_results(%args) -> [status, msg, payload, meta]
Delete old results.
By default it will only keep 1 latest result for each scenario for the same CPU and the same module versions.
You can use --dry-run first to see which files would be deleted without actually deleting them.
--dry-run
This function supports dry-run operation.
detail => bool
num_keep => int (default: 0)
Number of old results to keep.
query => array[str]
result_dir* => str
Directory to store results files in.
Special arguments:
-dry_run => bool
Pass -dry_run=>1 to enable simulation mode.
format_bencher_result(%args) -> [status, msg, payload, meta]
Format bencher raw/JSON result.
list_bencher_results(%args) -> [status, msg, payload, meta]
List results in results directory.
exclude_scenarios => array[str]
fmt => bool
Display each result with bencher-fmt.
include_scenarios => array[str]
latest => bool
module_startup => bool
list_bencher_scenario_modules(%args) -> [status, msg, payload, meta]
List Bencher scenario modules.
query => str
Please visit the project's homepage at https://metacpan.org/release/App-BencherUtils.
Source repository is at https://github.com/perlancar/perl-App-BencherUtils.
Please report any bugs or feature requests on the bugtracker website https://github.com/perlancar/perl-App-BencherUtils/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
perlancar <perlancar@cpan.org>
This software is copyright (c) 2021, 2019, 2018, 2017, 2016 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::BencherUtils, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::BencherUtils
CPAN shell
perl -MCPAN -e shell install App::BencherUtils
For more information on module installation, please visit the detailed CPAN module installation guide.