« blib/lib/Benchmark/Perl/Formance/Plugin/P6STD.pm
↑ Summary
blib/lib/Benchmark/Perl/Formance/Plugin/Shootout.pm »
| 1 | package Benchmark::Perl::Formance; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # git description: v0.54-2-g52509be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 541 | our $AUTHORITY = 'cpan:SCHWIGON'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # ABSTRACT: Perl 5 performance benchmarking framework | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 541 | $Benchmark::Perl::Formance::VERSION = '0.55'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 541 | ▶ | use 5.008; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 541 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 541 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 541 | ▶ | use Config; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 541 | ▶ | use Config::Perl::V; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 541 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 541 | ▶ | use Getopt::Long ":config", "no_ignore_case", "bundling"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 541 | ▶ | use Data::Structure::Util "unbless"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 541 | ▶ | use Time::HiRes qw(gettimeofday); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 541 | ▶ | use Devel::Platform::Info; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 541 | ▶ | use List::Util "max"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 541 | ▶ | use Data::DPath 'dpath', 'dpathi'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 541 | ▶ | use File::Find; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 541 | ▶ | use Storable "fd_retrieve", "store_fd"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 541 | ▶ | use Sys::Hostname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 541 | ▶ | use Sys::Info; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 541 | ▶ | use FindBin qw($Bin); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 541 | ▶ | use Module::Pluggable; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 541 | ▶ | use Module::Runtime qw/ require_module /; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # comma separated list of default plugins - basically the non-troublemakers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 541 | my $DEFAULT_PLUGINS = join ",", qw(DPath | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | Fib | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | FibOO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | Mem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | MatrixReal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | Prime | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | Rx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | RxMicro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | Shootout::fasta | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | Shootout::regexdna | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | Shootout::binarytrees | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | Shootout::revcomp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | Shootout::nbody | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | Shootout::spectralnorm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # FibMXDeclare | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 541 | my $ALL_PLUGINS = join ",", qw(DPath | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | Fib | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | FibMoose | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | FibMouse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | FibOO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | FibOOSig | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | MatrixReal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | Mem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | P6STD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | PerlCritic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | Prime | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | RegexpCommonTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | Rx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | RxMicro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | RxCmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | Shootout::binarytrees | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | Shootout::fannkuch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | Shootout::fasta | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | Shootout::knucleotide | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | Shootout::mandelbrot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | Shootout::nbody | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | Shootout::pidigits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | Shootout::regexdna | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | Shootout::revcomp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | Shootout::spectralnorm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | SpamAssassin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | Threads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ThreadsShared | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 541 | our $scaling_script = "$Bin/benchmark-perlformance-set-stable-system"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 541 | our $metric_prefix = "perlformance.perl5"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 541 | our $DEFAULT_INDENT = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 541 | my @run_plugins; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # incrementaly interesting Perl Config keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 541 | my %CONFIG_KEYS = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 1 => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | qw(perlpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | archname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | archname64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | osvers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | usethreads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | useithreads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 2 => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | qw(gccversion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | gnulibc_version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | usemymalloc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | config_args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | optimize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 3 => [qw(ccflags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | ccname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | cccdlflags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ccdlflags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | cppflags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | nm_so_opt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 4 => [qw(PERL_REVISION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | PERL_VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | PERL_SUBVERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | PERL_PATCHLEVEL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | api_revision | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | api_version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | api_subversion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | api_versionstring | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | git_branch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | git_commit_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | git_describe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | git_uncommitted_changes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | gnulibc_version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | dtrace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | doublesize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | alignbytes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | bin_ELF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | git_commit_date | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | version_patchlevel_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | d_mymalloc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | i16size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | i16type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | i32size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | i32type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | i64size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | i64type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | i8size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | i8type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | longdblsize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | longlongsize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | longsize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | perllibs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | ptrsize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | quadkind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | quadtype | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | randbits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 5 => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | sort keys %Config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 538 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 538 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 538 | bless { %args }, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | sub load_all_plugins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_all_plugins: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 43 | ▶ | my $version = $_->[1] ? $_->[0]->VERSION : '~'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 43 | (my $name = $_->[0]) =~ s/.*::Plugin:://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 43 | $name => $version; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | map { [ $_ => eval { require_module($_) } ] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | __PACKAGE__->plugins; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | sub print_version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_version: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | ▶ | if ($self->{options}{verbose}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | print "Benchmark::Perl::Formance version $Benchmark::Perl::Formance::VERSION\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | print "Plugins:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | my %plugins = load_all_plugins; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | print " (v$plugins{$_}) $_\n" foreach sort keys %plugins; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | print $Benchmark::Perl::Formance::VERSION, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | sub usage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
usage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | print 'benchmark-perlformance - Frontend for Benchmark::Perl::Formance | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | Usage: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | $ benchmark-perlformance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | $ benchmark-perlformance --fastmode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | $ benchmark-perlformance --useforks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | $ benchmark-perlformance --plugins=SpamAssassin,RegexpCommonTS,RxCmp -v | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | $ benchmark-perlformance -ccccc --indent=2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | $ benchmark-perlformance -q | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | If run directly it uses the perl in your PATH: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | $ /path/to/benchmark-perlformance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | To use another perl start it via | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | $ /other/path/to/bin/perl /path/to/benchmark-perlformance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | For more details see | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | man benchmark-perlformance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | perldoc Benchmark::Perl::Formance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | '; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | sub do_disk_sync { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_disk_sync: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | system("sync ; sync"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | sub prepare_stable_system | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 537 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_stable_system: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 537 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 537 | my $orig_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 537 | ▶ | if ($self->{options}{stabilize_cpu} and $^O eq "linux") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"options"}{"stabilize_cpu"} and $^O eq "linux"
MC/DC0%0/2
$self->{"options"}{"stabilize_cpu"} and $^O eq "linux"
$self->{"options"}{"stabilize_cpu"}
$^O eq "linux"
Truth table33%1/3
A and B
A= $self->{"options"}{"stabilize_cpu"}B= $^O eq "linux"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $self->{orig_system_values} = qx(sudo $scaling_script lo); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | do_disk_sync(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | sub restore_stable_system | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
restore_stable_system: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my ($self, $orig_values) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if ($self->{options}{stabilize_cpu} and $^O eq "linux") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"options"}{"stabilize_cpu"} and $^O eq "linux"
MC/DC0%0/2
$self->{"options"}{"stabilize_cpu"} and $^O eq "linux"
$self->{"options"}{"stabilize_cpu"}
$^O eq "linux"
Truth table0%0/3
A and B
A= $self->{"options"}{"stabilize_cpu"}B= $^O eq "linux"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | if (open my $RESTORE, "|-", "sudo $scaling_script restore") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | print $RESTORE $self->{orig_system_values}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | close $RESTORE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | sub prepare_fast_system | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_fast_system: called CC=3 SCAR=13.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 2 | my $orig_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 2 | ▶ | if ($self->{options}{stabilize_cpu} and $^O eq "linux") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"options"}{"stabilize_cpu"} and $^O eq "linux"
MC/DC0%0/2
$self->{"options"}{"stabilize_cpu"} and $^O eq "linux"
$self->{"options"}{"stabilize_cpu"}
$^O eq "linux"
Truth table33%1/3
A and B
A= $self->{"options"}{"stabilize_cpu"}B= $^O eq "linux"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $self->{orig_system_values} = qx(sudo $scaling_script hi); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | sub _error_printing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_error_printing: called CC=6 SCAR=19.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 1 | my ($self, $pluginname, $error) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 1 | my @errors = split qr/\n/, $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 1 | ▶ | my $maxerr = ($#errors < 10) ? $#errors : 10; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 1 | ▶ | print STDERR "# Skip plugin '$pluginname'" if $self->{options}{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | ▶ | print STDERR ":".$errors[0] if $self->{options}{verbose} > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | ▶ | print STDERR join("\n# ", "", @errors[1..$maxerr]) if $self->{options}{verbose} > 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | ▶ | print STDERR "\n" if $self->{options}{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | sub run_plugin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 7401 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_plugin: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 7401 | my ($self, $pluginname) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 7401 | $pluginname =~ s,\.,::,g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 541 | ▶ | no strict 'refs'; ## no critic | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 7401 | ▶ | print STDERR "# Run $pluginname...\n" if $self->{options}{verbose} >= 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 7401 | my $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 7401 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 541 | ▶ | use IO::Handle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 7401 | pipe(PARENT_RDR, CHILD_WTR); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 7401 | CHILD_WTR->autoflush(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 7401 | my $pid = open(my $PLUGIN, "-|"); # implicit fork | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 7401 | ▶ | if ($pid == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # run in child process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 535 | close PARENT_RDR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 535 | ▶ | eval "use Benchmark::Perl::Formance::Plugin::$pluginname"; ## no critic | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 535 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $self->_error_printing($pluginname, $@); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 535 | $0 = "benchmark-perl-formance-$pluginname"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 535 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 535 | $res = &{"Benchmark::Perl::Formance::Plugin::${pluginname}::main"}($self->{options}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 15 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 1 | $self->_error_printing($pluginname, $@); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 1 | $res = { failed => $@ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 15 | $res->{PLUGIN_VERSION} = ${"Benchmark::Perl::Formance::Plugin::${pluginname}::VERSION"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 15 | store_fd($res, \*CHILD_WTR); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 15 | close CHILD_WTR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 15 | exit 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 6866 | close CHILD_WTR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 6866 | $res = fd_retrieve(\*PARENT_RDR); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 6866 | close PARENT_RDR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 6866 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | $res = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | failed => "Plugin $pluginname failed", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | ($self->{options}{verbose} > 3 ? ( error => $@ ) : ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 6866 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | # ,----------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # | That's specific to the Tapper wrapper around | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # | Benchmark::Perl::Formance and should be replaced | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # | with something generic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | sub _perl_gitversion { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_perl_gitversion: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | my $perlpath = "$^X"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $perlpath =~ s,/[^/]*$,,; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | my $perl_gitversion = "$perlpath/perl -MConfig -e 'print \$Config{bootstrap_perl_git_changeset}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | if (-x $perl_gitversion) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | my $gitversion = qx!$perl_gitversion! ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | chomp $gitversion; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | return $gitversion; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | sub _perl_gitdescribe { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_perl_gitdescribe: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | my $perlpath = "$^X"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $perlpath =~ s,/[^/]*$,,; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | my $perl_gitdescribe = "$perlpath/perl -MConfig -e 'print \$Config{bootstrap_perl_git_describe}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | if (-x $perl_gitdescribe) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my $gitdescribe = qx!$perl_gitdescribe! ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | chomp $gitdescribe; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | return $gitdescribe; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | sub _perl_symbolic_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_perl_symbolic_name: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | my $perlpath = "$^X"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | $perlpath =~ s,/[^/]*$,,; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | my $perl_symbolic_name = "$perlpath/perl -MConfig -e 'print \$Config{bootstrap_perl_symbolic_name}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | if (-x $perl_symbolic_name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my $executable = qx!$perl_symbolic_name! ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | chomp $executable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | return $executable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # '----------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | sub _get_hostname { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_hostname: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | my $host = "unknown-hostname"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | eval { $host = hostname }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | $host = "perl64.org" if $host eq "h1891504"; # special case for PerlFormance.Net Æsthetics | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | return $host; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 21 | ▶ | sub _plugin_results { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_plugin_results: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 21 | my ($self, $plugin, $RESULTS) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 21 | my @resultkeys = split(/\./, $plugin); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 21 | my ($res) = dpath("/results/".join("/", map { qq("$_") } @resultkeys)."/Benchmark/*[0]")->match($RESULTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 21 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | sub _codespeed_meta { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_codespeed_meta: not called CC=16 SCAR=56.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | my ($self, $RESULTS) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | my $codespeed_exe_suffix = $self->{options}{cs_executable_suffix} || $ENV{CODESPEED_EXE_SUFFIX} || ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$self->{'options'}{'cs_executable_suffix'} || $ENV{'CODESPEED_EXE_SUFFIX'} || ''
$self->{"options"}{"cs_executable_suffix"} or $ENV{"CODESPEED_EXE_SUFFIX"}
MC/DC0%0/2
$self->{'options'}{'cs_executable_suffix'} || $ENV{'CODESPEED_EXE_SUFFIX'} || ''
$self->{"options"}{"cs_executable_suffix"}
$ENV{"CODESPEED_EXE_SUFFIX"}
Truth table0%0/3
A or B
A= $self->{"options"}{"cs_executable_suffix"}B= $ENV{"CODESPEED_EXE_SUFFIX"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | my $codespeed_exe = $self->{options}{cs_executable} || _perl_symbolic_name || sprintf("perl-%s.%s%s", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | $Config{PERL_REVISION}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | $Config{PERL_VERSION}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | $codespeed_exe_suffix, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$self->{'options'}{'cs_executable'} || _perl_symbolic_name() || sprintf('perl-%s.%s%s', $Benchmark::Perl::Formance::Config{'PERL_REVISION'}, $Benchmark::Perl::Formance::Config{'PERL_VERSION'}, $codespeed_exe_suffix)
$self->{"options"}{"cs_executable"} or _perl_symbolic_name()
MC/DC0%0/2
$self->{'options'}{'cs_executable'} || _perl_symbolic_name() || sprintf('perl-%s.%s%s', $Benchmark::Perl::Formance::Config{'PERL_REVISION'}, $Benchmark::Perl::Formance::Config{'PERL_VERSION'}, $codespeed_exe_suffix)
$self->{"options"}{"cs_executable"}
_perl_symbolic_name()
Truth table0%0/3
A or B
A= $self->{"options"}{"cs_executable"}B= _perl_symbolic_name()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | my $codespeed_project = $self->{options}{cs_project} || $ENV{CODESPEED_PROJECT} || "perl5"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$self->{'options'}{'cs_project'} || $ENV{'CODESPEED_PROJECT'} || 'perl5'
$self->{"options"}{"cs_project"} or $ENV{"CODESPEED_PROJECT"}
MC/DC0%0/2
$self->{'options'}{'cs_project'} || $ENV{'CODESPEED_PROJECT'} || 'perl5'
$self->{"options"}{"cs_project"}
$ENV{"CODESPEED_PROJECT"}
Truth table0%0/3
A or B
A= $self->{"options"}{"cs_project"}B= $ENV{"CODESPEED_PROJECT"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | my $codespeed_branch = $self->{options}{cs_branch} || $ENV{CODESPEED_BRANCH} || "default"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$self->{'options'}{'cs_branch'} || $ENV{'CODESPEED_BRANCH'} || 'default'
$self->{"options"}{"cs_branch"} or $ENV{"CODESPEED_BRANCH"}
MC/DC0%0/2
$self->{'options'}{'cs_branch'} || $ENV{'CODESPEED_BRANCH'} || 'default'
$self->{"options"}{"cs_branch"}
$ENV{"CODESPEED_BRANCH"}
Truth table0%0/3
A or B
A= $self->{"options"}{"cs_branch"}B= $ENV{"CODESPEED_BRANCH"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | my $codespeed_commitid = $self->{options}{cs_commitid} || $ENV{CODESPEED_COMMITID} || $Config{git_commit_id} || _perl_gitversion || "no-commit"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/11
$self->{'options'}{'cs_commitid'} || $ENV{'CODESPEED_COMMITID'} || $Benchmark::Perl::Formance::Config{'git_commit_id'} || _perl_gitversion() || 'no-commit'
$self->{"options"}{"cs_commitid"} or $ENV{"CODESPEED_COMMITID"} or $Benchmark::Perl::Formance::Config{"git_commit_id"} or _perl_gitversion()
$self->{"options"}{"cs_commitid"} or $ENV{"CODESPEED_COMMITID"} or $Benchmark::Perl::Formance::Config{"git_commit_id"}
$self->{"options"}{"cs_commitid"} or $ENV{"CODESPEED_COMMITID"}
MC/DC0%0/4
$self->{'options'}{'cs_commitid'} || $ENV{'CODESPEED_COMMITID'} || $Benchmark::Perl::Formance::Config{'git_commit_id'} || _perl_gitversion() || 'no-commit'
$self->{"options"}{"cs_commitid"}
$ENV{"CODESPEED_COMMITID"}
$Benchmark::Perl::Formance::Config{"git_commit_id"}
_perl_gitversion()
Truth table0%0/5
A or B or C or D
A= $self->{"options"}{"cs_commitid"}B= $ENV{"CODESPEED_COMMITID"}C= $Benchmark::Perl::Formance::Config{"git_commit_id"}D= _perl_gitversion()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | my $codespeed_environment = $self->{options}{cs_environment} || $ENV{CODESPEED_ENVIRONMENT} || _get_hostname || "no-env"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/8
$self->{'options'}{'cs_environment'} || $ENV{'CODESPEED_ENVIRONMENT'} || _get_hostname() || 'no-env'
$self->{"options"}{"cs_environment"} or $ENV{"CODESPEED_ENVIRONMENT"} or _get_hostname()
$self->{"options"}{"cs_environment"} or $ENV{"CODESPEED_ENVIRONMENT"}
MC/DC0%0/3
$self->{'options'}{'cs_environment'} || $ENV{'CODESPEED_ENVIRONMENT'} || _get_hostname() || 'no-env'
$self->{"options"}{"cs_environment"}
$ENV{"CODESPEED_ENVIRONMENT"}
_get_hostname()
Truth table0%0/4
A or B or C
A= $self->{"options"}{"cs_environment"}B= $ENV{"CODESPEED_ENVIRONMENT"}C= _get_hostname()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my %codespeed_meta = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | executable => $codespeed_exe, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | project => $codespeed_project, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | branch => $codespeed_branch, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | commitid => $codespeed_commitid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | environment => $codespeed_environment, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | return %codespeed_meta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | sub _get_bootstrap_perl_meta { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_bootstrap_perl_meta: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | return map { ("$_" => $Config{$_}) } grep { /^bootstrap_perl/ } keys %Config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # Convert value: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # - Perlish undef --> 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # - String "define" --> 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # - everything else keep the same | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | sub _booleanize_define { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_booleanize_define: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | my ($value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | if (not defined $value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } elsif ($value eq "define") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | sub _taint_available { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_taint_available: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | require Scalar::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | require Cwd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | Scalar::Util::tainted(Cwd::getcwd()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | sub _get_perl_config_notaintsupport { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_perl_config_notaintsupport: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my $config_args = $Config{config_args}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | my $notaintsupport = 0; # standard | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | if ($config_args =~ /(SILENT_)?NO_TAINT_SUPPORT\b/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | if ($config_args =~ /SILENT_NO_TAINT_SUPPORT\b/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | $notaintsupport = 1; # no further check possible | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | $notaintsupport = 1 if not _taint_available(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | return $notaintsupport; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | sub _get_perl_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_perl_config: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | my @cfgkeys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | my $showconfig = 4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | push @cfgkeys, @{$CONFIG_KEYS{$_}} foreach 1..$showconfig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | my %perlconfig = map { ("perlconfig_$_" => $Config{$_}) } @cfgkeys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | $perlconfig{perlconfig_derived_notaintsupport} = $self->_get_perl_config_notaintsupport(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | return %perlconfig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | sub _get_perl_config_v { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_perl_config_v: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | # only when ultimate verbose config requested | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | return unless $self->{options}{showconfig} >= 5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | my $config_v_myconfig = Config::Perl::V::myconfig (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my @config_v_keys = sort keys %$config_v_myconfig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | # --- flat configs --- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | my $prefix = "perlconfigv"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | my %perlconfigv = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | my %focus = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | derived => [ qw( Off_t uname) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | build => [ qw( osname stamp ) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | environment => [ keys %{$config_v_myconfig->{environment}} ], # all | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | foreach my $subcfg (keys %focus) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | foreach my $k (@{$focus{$subcfg}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $perlconfigv{join("_", $prefix, $subcfg, $k)} = $config_v_myconfig->{$subcfg}{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # --- nested configs --- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # build options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | my @buildoptionkeys = keys %{$config_v_myconfig->{build}{options}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | foreach my $k (keys %focus) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | $perlconfigv{join("_", $prefix, "build", "options", $k)} = $config_v_myconfig->{build}{options}{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | return %perlconfigv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | sub _get_perlformance_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_perlformance_config: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | # only easy printable data (i.e., no "D" hash) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | my @config_keys = (qw(stabilize_cpu | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | fastmode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | useforks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | plugins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | )); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ▶ | return map { $self->{options}{$_} ? ("perlformance_$_" => $self->{options}{$_}) : () } @config_keys; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | sub _get_perlformance_env | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_perlformance_env: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | # environment variables matching /^PERLFORMANCE_/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my @config_keys = grep { $ENV{$_} ne '' } grep /^PERLFORMANCE_/, keys %ENV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | return map { lc("env_$_") => $ENV{$_} } @config_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 1 | ▶ | sub _get_platforminfo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_platforminfo: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 1 | my $get_info = Devel::Platform::Info->new->get_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 1 | delete $get_info->{source}; # this currently breaks the simplified YAMLish | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 1 | return %$get_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | sub _get_sysinfo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_sysinfo: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | my %sysinfo = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | my $prefix = "sysinfo"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | my $cpu = (Sys::Info->new->device("CPU")->identify)[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | $sysinfo{"${prefix}_hostname"} = _get_hostname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | $sysinfo{join("_", $prefix, "cpu", $_)} = $cpu->{$_} foreach qw(name | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | family | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | model | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | stepping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | architecture | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | number_of_cores | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | number_of_logical_processors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | architecture | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | manufacturer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | $sysinfo{join("_", $prefix, "cpu", "l2_cache", "max_cache_size")} = $cpu->{L2_cache}{max_cache_size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | return %sysinfo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | ▶ | sub augment_results_with_meta { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
augment_results_with_meta: not called CC=4 SCAR=25.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | my ($self, $NAME_KEY, $VALUE_KEY, $META, $RESULTS) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | my @run_plugins = $self->find_interesting_result_paths($RESULTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | my @new_entries = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | foreach my $plugin (sort @run_plugins) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 541 | ▶ | no strict 'refs'; ## no critic | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | my $res = $self->_plugin_results($plugin, $RESULTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | my $benchmark = join ".", $metric_prefix, ($self->{options}{fastmode} ? "$plugin(F)" : $plugin); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | ▶ | push @new_entries, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$res || 0
MC/DC0%0/1
$res || 0
$res
Truth table0%0/2
A
A= $res
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | %$META, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | # metric name and value at last position to override | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | $NAME_KEY => $benchmark, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | $VALUE_KEY => ($res || 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | return \@new_entries; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | sub generate_codespeed_data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_codespeed_data: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | my ($self, $RESULTS) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | my %META = _codespeed_meta(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | return $self->augment_results_with_meta("benchmark", "result_value", \%META, $RESULTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | sub generate_BenchmarkAnythingData_data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_BenchmarkAnythingData_data: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | my ($self, $RESULTS, $codespeed) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | # share a common dataset with Codespeed, yet prefix it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | my %codespeed_meta = $codespeed ? _codespeed_meta : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | my %prefixed_codespeed_meta = map { ("codespeed_$_" => $codespeed_meta{$_}) } keys %codespeed_meta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | my %platforminfo = $self->_get_platforminfo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | my %prefixed_platforminfo = map { ("platforminfo_$_" => $platforminfo{$_}) } keys %platforminfo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | my %META = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | %prefixed_platforminfo, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | %prefixed_codespeed_meta, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | $self->_get_bootstrap_perl_meta, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | $self->_get_perl_config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | $self->_get_perl_config_v, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | $self->_get_sysinfo, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | $self->_get_perlformance_config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | $self->_get_perlformance_env, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | return $self->augment_results_with_meta("NAME", "VALUE", \%META, $RESULTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 538 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=25 SCAR=37.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 538 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 538 | my $help = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 538 | my $showconfig = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 538 | my $outstyle = "summary"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 538 | my $outfile = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 538 | my $platforminfo = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 538 | my $codespeed = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 538 | my $tap = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 538 | my $tap_plan = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 538 | my $tap_headers = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 538 | my $benchmarkanything = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 538 | my $benchmarkanything_report = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 538 | my $cs_executable_suffix = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 538 | my $cs_executable = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 538 | my $cs_project = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 538 | my $cs_branch = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 538 | my $cs_commitid = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 538 | my $cs_environment = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 538 | my $verbose = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 538 | my $version = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 538 | my $fastmode = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 538 | my $useforks = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 538 | my $quiet = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 538 | my $stabilize_cpu = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 538 | my $plugins = $DEFAULT_PLUGINS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 538 | my $indent = $DEFAULT_INDENT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 538 | my $tapdescription = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 538 | my $D = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | # get options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 538 | my $ok = GetOptions ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | "help|h" => \$help, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | "quiet|q" => \$quiet, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | "indent=i" => \$indent, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | "plugins=s" => \$plugins, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | "verbose|v+" => \$verbose, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | "outstyle=s" => \$outstyle, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | "outfile=s" => \$outfile, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | "fastmode" => \$fastmode, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | "version" => \$version, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | "useforks" => \$useforks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | "stabilize-cpu" => \$stabilize_cpu, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | "showconfig|c+" => \$showconfig, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | "platforminfo|p" => \$platforminfo, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | "codespeed" => \$codespeed, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | "tap" => \$tap, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | "tap-plan" => \$tap_plan, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | "tap-headers" => \$tap_headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | "benchmarkanything" => \$benchmarkanything, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | "benchmarkanything-report" => \$benchmarkanything_report, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | "cs-executable-suffix=s" => \$cs_executable_suffix, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | "cs-executable=s" => \$cs_executable, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | "cs-project=s" => \$cs_project, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | "cs-branch=s" => \$cs_branch, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | "cs-commitid=s" => \$cs_commitid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | "cs-environment=s" => \$cs_environment, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | "tapdescription=s" => \$tapdescription, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | "D=s%" => \$D, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | # special meta options - order matters! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 538 | ▶ | if ($tap or $tap_plan) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$tap or $tap_plan
MC/DC0%0/2
$tap or $tap_plan
$tap
$tap_plan
Truth table33%1/3
A or B
A= $tapB= $tap_plan
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | $tapdescription = 'perlformance results'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | $outstyle = 'yamlish'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | $indent = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | $platforminfo = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | $showconfig = 4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 538 | ▶ | $benchmarkanything = 1 if $benchmarkanything_report; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 538 | ▶ | $platforminfo = 1 if $benchmarkanything; # -p | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 538 | ▶ | $showconfig = 4 if $benchmarkanything; # -cccc | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 538 | ▶ | $outstyle = 'json' if $benchmarkanything and $outstyle !~ /^(json|yaml|yamlish)$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$benchmarkanything and not $outstyle =~ /^(json|yaml|yamlish)$/
MC/DC0%0/2
$benchmarkanything and not $outstyle =~ /^(json|yaml|yamlish)$/
$benchmarkanything
not $outstyle =~ /^(json|yaml|yamlish)$/
Truth table33%1/3
A and not(B)
A= $benchmarkanythingB= not $outstyle =~ /^(json|yaml|yamlish)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 538 | ▶ | $outstyle = 'json' if $benchmarkanything_report; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | # fill options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | $self->{options} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 538 | help => $help, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | quiet => $quiet, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | verbose => $verbose, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | outfile => $outfile, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | outstyle => $outstyle, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | fastmode => $fastmode, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | useforks => $useforks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | stabilize_cpu => $stabilize_cpu, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | showconfig => $showconfig, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | platforminfo => $platforminfo, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | codespeed => $codespeed, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | tap => $tap, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | tap_plan => $tap_plan, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | tap_headers => $tap_headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | benchmarkanything => $benchmarkanything, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | benchmarkanything_report => $benchmarkanything_report, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | cs_executable_suffix => $cs_executable_suffix, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | cs_executable => $cs_executable, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | cs_project => $cs_project, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | cs_branch => $cs_branch, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | cs_commitid => $cs_commitid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | cs_environment => $cs_environment, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | plugins => $plugins, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | tapdescription => $tapdescription, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | indent => $indent, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | D => $D, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 538 | ▶ | do { $self->print_version; exit 0 } if $version; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | do { usage; exit 0 } if $help; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | ▶ | do { usage; exit -1 } if not $ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | # use forks if requested | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 537 | ▶ | if ($useforks) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | eval "use forks"; ## no critic | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | ▶ | $useforks = 0 if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | ▶ | print STDERR "# use forks " . ($@ ? "failed" : "") . "\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | # static list because dynamic require influences runtimes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 537 | ▶ | $plugins = $ALL_PLUGINS if $plugins eq "ALL"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | # run plugins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 537 | my $before = gettimeofday(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 537 | my %RESULTS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 537 | my @plugins = grep /\w/, split '\s*,\s*', $plugins; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 537 | $self->prepare_stable_system; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 537 | foreach (@plugins) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 7401 | my @resultkeys = split(qr/::|\./, $_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 7401 | my $res = $self->run_plugin($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 6866 | eval "\$RESULTS{results}{".join("}{", @resultkeys)."} = \$res"; ## no critic | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 2 | $self->prepare_fast_system; # simply set to max, as restore_stable_system() is no reliable approach anyway | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 2 | my $after = gettimeofday(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 2 | $RESULTS{perlformance}{overall_runtime} = $after - $before; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 2 | $RESULTS{perlformance}{config}{fastmode} = $fastmode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 2 | $RESULTS{perlformance}{config}{use_forks} = $useforks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | # Perl Config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 2 | ▶ | if ($showconfig) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | # Config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 1 | my @cfgkeys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 1 | push @cfgkeys, @{$CONFIG_KEYS{$_}} foreach 1..$showconfig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | $RESULTS{perl_config} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 1 | map { $_ => $Config{$_} } sort @cfgkeys | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | # Config::Perl::V | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 1 | $RESULTS{perl_config_v} = Config::Perl::V::myconfig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | # Perl Config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 2 | ▶ | if ($platforminfo) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 1 | $RESULTS{platform_info} = { $self->_get_platforminfo }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | # Codespeed data blocks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 2 | ▶ | if ($codespeed) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | $RESULTS{codespeed} = $self->generate_codespeed_data(\%RESULTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | # TAP or BenchmarkAnythingData blocks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 2 | ▶ | if ($tap or $tap_plan or $benchmarkanything) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$tap or $tap_plan or $benchmarkanything
$tap or $tap_plan
MC/DC0%0/3
$tap or $tap_plan or $benchmarkanything
$tap
$tap_plan
$benchmarkanything
Truth table25%1/4
A or B or C
A= $tapB= $tap_planC= $benchmarkanything
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | $RESULTS{BenchmarkAnythingData} = $self->generate_BenchmarkAnythingData_data(\%RESULTS, $codespeed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 2 | unbless (\%RESULTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 2 | return \%RESULTS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | sub print_outstyle_yaml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_outstyle_yaml: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | my ($self, $RESULTS) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | require YAML; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | return YAML::Dump($RESULTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | sub print_outstyle_json | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_outstyle_json: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | my ($self, $RESULTS) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | require JSON; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | return JSON->new->allow_nonref->pretty->encode( $RESULTS ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | sub print_outstyle_yamlish | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_outstyle_yamlish: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 1 | my ($self, $RESULTS) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 1 | require Data::YAML::Writer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 1 | my $output = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 1 | my $indent = $self->{options}{indent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 1 | my $yw = Data::YAML::Writer->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 1 | ▶ | $yw->write($RESULTS, sub { $output .= shift()."\n" }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 1 | $output =~ s/^/" "x$indent/emsg; # indent | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 1 | my $tapdescription = $self->{options}{tapdescription}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 1 | ▶ | $output = "ok $tapdescription\n".$output if $tapdescription; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 1 | return $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | sub find_interesting_result_paths | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_interesting_result_paths: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 1 | my ($self, $RESULTS) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 1 | my @all_keys = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 1 | my $benchmarks = dpathi($RESULTS)->isearch("//Benchmark"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 1 | ▶ | while ($benchmarks->isnt_exhausted) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 21 | my @keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 21 | my $benchmark = $benchmarks->value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 21 | my $ancestors = $benchmark->isearch ("/::ancestor"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 21 | ▶ | while ($ancestors->isnt_exhausted) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 89 | my $key = $ancestors->value->first_point->{attrs}{key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 89 | ▶ | push @keys, $key if defined $key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 21 | pop @keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 21 | push @all_keys, join(".", reverse @keys); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 1 | return @all_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | sub print_outstyle_summary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_outstyle_summary: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 1 | my ($self, $RESULTS) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 1 | my $output = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 1 | my @run_plugins = $self->find_interesting_result_paths($RESULTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 1 | my $len = max map { length } @run_plugins; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 1 | $len += 1+length($metric_prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 1 | foreach (sort @run_plugins) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 541 | ▶ | no strict 'refs'; ## no critic | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 21 | my $res = $self->_plugin_results($_, $RESULTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 21 | ▶ | $output .= sprintf("%-${len}s : %f\n", join(".", $metric_prefix, $_), ($res || 0)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$res || 0
MC/DC0%0/1
$res || 0
$res
Truth table50%1/2
A
A= $res
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 1 | return $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | sub print_results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_results: called CC=11 SCAR=39.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 2 | my ($self, $RESULTS) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 2 | ▶ | return if $self->{options}{quiet}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 2 | my $outstyle = lc $self->{options}{outstyle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 2 | ▶ | $outstyle = "summary" unless $outstyle =~ qr/^(summary|yaml|yamlish|json)$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 2 | my $sub = "print_outstyle_$outstyle"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 2 | my $output = $self->$sub($RESULTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | # tap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 2 | my $tap_plan = lc $self->{options}{tap_plan}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 2 | my $tap_headers = lc $self->{options}{tap_headers}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 2 | my $lead_tap = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 2 | ▶ | $lead_tap .= "1..$tap_plan\n" if $tap_plan; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 2 | ▶ | if ($tap_headers) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | $lead_tap .= "# Test-suite-name: benchmark-perlformance\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | $lead_tap .= "# Test-machine-name: "._get_hostname."\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 2 | $output = $lead_tap.$output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 2 | ▶ | if (my $outfile = $self->{options}{outfile}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | ▶ | open my $OUTFILE, ">", $outfile or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | warn "Can not open $outfile. Printing to STDOUT.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | print $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | print $OUTFILE $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | close $OUTFILE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | elsif ($self->{options}{benchmarkanything_report}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | my $ba_reporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | require BenchmarkAnything::Reporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | $ba_reporter = BenchmarkAnything::Reporter->new(verbose => $self->{options}{verbose}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | $ba_reporter->report({BenchmarkAnythingData => $RESULTS->{BenchmarkAnythingData}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | ▶ | if ($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | print STDERR "# Could not add results to storage: $@\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | require JSON; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | require File::Path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | require File::Temp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | require File::Basename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | my $result_dir = File::Basename::dirname($ba_reporter->{config}{cfgfile}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | ▶ | if (! -w $result_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | require File::HomeDir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | $result_dir = File::HomeDir->my_home; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | ▶ | if (! -w $result_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | require File::Temp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | $result_dir = tempdir(CLEANUP => 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | my $timestamp1 = sprintf("%04d-%02d-%02d", 1900+$year, $mon, $mday); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | my $timestamp2 = sprintf("%02d-%02d-%02d", $hour, $min, $sec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | my $result_path = "$result_dir/unreported_results/$timestamp1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | File::Path::make_path($result_path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | my ($FH, $result_file) = File::Temp::tempfile ("$timestamp2-XXXX", DIR => $result_path, SUFFIX => ".json"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | print STDERR "# Writing them to file: $result_file\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | print $FH JSON->new->allow_nonref->pretty->encode({BenchmarkAnythingData => $RESULTS->{BenchmarkAnythingData}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 2 | print $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 541 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||