blib/lib/Benchmark/Perl/Formance/Plugin/Skeleton.pm

filter: Statementstmt 63.6% 14 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 1 totaltotal 53.1% 17 / 32 CC 3 SCAR 17.7
CC
3
Cov
54%
main
12.0
__ANON__
2.0
BEGIN
1.0
CRAP 5.9
« blib/lib/Benchmark/Perl/Formance/Plugin/DPath.pm ↑ Summary blib/lib/Benchmark/Perl/Formance/Plugin/AccessorsArray.pm »
1 package Benchmark::Perl::Formance::Plugin::Skeleton;
2 1 our $AUTHORITY = 'cpan:SCHWIGON';
3 # ABSTRACT: benchmark plugin - Skeleton - An example plugin
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = "0.001";
9  
10 #############################################################
11 # #
12 # Benchmark Code ahead - Don't touch without strong reason! #
13 # #
14 #############################################################
15  
16 1 ▶use Benchmark ':hireswallclock';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 our $goal;
19 1 our $count;
20  
21 0 ▶sub main {
Subroutine main: not called CC=3 SCAR=24.8
Pod undocumented
22 0 my ($options) = @_;
23  
24 0 ▶ $goal = $options->{fastmode} ? 2 : 10; # benchmark parameter that influences single run duration
Branch: 1 branch
BranchTrueFalseTotal
$options->{'fastmode'} ? : 0 0 0
25 0 ▶ $count = $options->{fastmode} ? 1 : 5; # run that many iterations
Branch: 1 branch
BranchTrueFalseTotal
$options->{'fastmode'} ? : 0 0 0
26  
27 0 my $result;
28 0 ▶ my $t = timeit $count, sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 # REAL CODE HERE
30 0 sleep $goal;
31 0 $result = 7;
32 0 };
33 return {
34 0 Benchmark => $t, # "Benchmark" is the only important key
35 goal => $goal, # \
36 count => $count, # | Just meta info for debugging / arguing / questioning.
37 result => $result, # /
38 };
39 }
40  
41 1 1;
42  
43 __END__
« blib/lib/Benchmark/Perl/Formance/Plugin/DPath.pm ↑ Summary blib/lib/Benchmark/Perl/Formance/Plugin/AccessorsArray.pm »