| 1 | package Benchmarks; | ||||||||||||||||||||||||||||||||
| 2 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use Benchmark qw/ :hireswallclock /; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 7 | our $VERSION = '0.09'; | |||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | sub import { | ||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | my ($class, $code, $count, $style, $title) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=9 SCAR=22.7
| |||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 7 | Benchmark->export_to_level(1, $class, ':all'); | |||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | 7 | ▶ | return unless $code; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 13 | 5 | ▶ | return unless ref $code eq 'CODE'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 5 | my ($ret, $runtime_count, $runtime_style, $runtime_title) = $code->(); | |||||||||||||||||||||||||||||||
| 16 | 5 | ▶ | $count = defined($runtime_count) ? $runtime_count | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 17 | : defined($count) ? $count | ||||||||||||||||||||||||||||||||
| 18 | : -1; | ||||||||||||||||||||||||||||||||
| 19 | 5 | ▶ | $style = defined($runtime_style) ? $runtime_style | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 20 | : defined($style) ? $style | ||||||||||||||||||||||||||||||||
| 21 | : 'auto'; | ||||||||||||||||||||||||||||||||
| 22 | 5 | ▶ | $title = defined($runtime_title) ? $runtime_title | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 23 | : defined($title) ? $title | ||||||||||||||||||||||||||||||||
| 24 | : undef; | ||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | 5 | _run_benchmark($count, $ret, $style, $title); | |||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||
| 29 | sub _run_benchmark { | ||||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | my ($count, $ret, $style, $title) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
_run_benchmark: called CC=4 SCAR=14.3
| |||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | 5 | my $ref_ret = ref $ret; | |||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | 5 | ▶ | if ( !$ref_ret || $ref_ret eq 'CODE' ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
not $ref_ret or $ref_ret eq "CODE"
MC/DC50%1/2
not $ref_ret or $ref_ret eq "CODE"
not $ref_ret
$ref_ret eq "CODE"
Truth table66%2/3
not(A) or B
A= not $ref_retB= $ref_ret eq "CODE"
| |||||||||||||||||||||||||||||||||
| 35 | 3 | Benchmark::timethis($count, $ret, $title, $style); | |||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||
| 37 | elsif ( $ref_ret eq 'HASH' ) { | ||||||||||||||||||||||||||||||||
| 38 | 2 | Benchmark::cmpthese($count, $ret, $style); | |||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||
| 40 | else { | ||||||||||||||||||||||||||||||||
| 41 | 0 | die "The CODE returned wrong retval."; | |||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | 7 | 1; | |||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | __END__ | ||||||||||||||||||||||||||||||||