/
survey
80 lines (46 loc) · 1.43 KB
/
survey
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/perl
# survey
use Getopt::Std;
getopts( 'tp:i:', \my %opts );
unless( $opts{'p'} =~ m/\A((?:[A-Z0-9_]+)(?:::[A-Z0-9_]+)*)\z/i ) {
die "Invalid package name [$opts{'p'}]\n";
}
eval "use $1; 1";
use Surveyor::App;
if( $opts{'t'} ) {
Surveyor::App::test( $opts{'p'}, @ARGV ) or
die( 'Tests do not pass for $opts{p}' );
}
$opts{'i'} = int( $opts{'i'} );
Surveyor::App::run( $opts{'p'}, int($opts{'i'}) || 10_000, @ARGV );
=encoding utf8
=head1 NAME
Surveyor::App - Run benchmarks from a package
=head1 SYNOPSIS
% survey -p PACKAGE -i ITERATIONS -t ARGS;
=head1 DESCRIPTION
C<survey> runs the benchmark subroutines from a package. That way,
you can pass over your benchmarks as a module.
=over 4
=item -p PACKAGE
The package that has the C<bench_>.
=item -i ITERATIONS
The number of iterations to run.
Default: 10_000
=item -t
Run tests to ensure that call C<bench_> subroutines return the same
thing.
=back
=head1 TO DO
=head1 SEE ALSO
=head1 SOURCE AVAILABILITY
This source is in a Git repository that I haven't made public
because I haven't bothered to set it up. If you want to clone
it, just ask and we'll work something out.
https://github.com/briandfoy/surveyor-app
=head1 AUTHOR
brian d foy, C<< <briandfoy@pobox.com> >>
=head1 COPYRIGHT AND LICENSE
Copyright © 2013-2024, brian d foy <briandfoy@pobox.com>. All rights reserved.
You may redistribute this under the terms of the Artistic License 2.0.
=cut