| Filename | /home/ss5/local/projects/Benchmark-Perl-Formance/lib/Benchmark/Perl/Formance.pm |
| Statements | Executed 177 statements in 105ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 97.4ms | 5.54s | Benchmark::Perl::Formance::run_plugin |
| 1 | 1 | 1 | 6.45ms | 7.10ms | Benchmark::Perl::Formance::BEGIN@18 |
| 1 | 1 | 1 | 6.06ms | 23.0ms | Benchmark::Perl::Formance::BEGIN@11 |
| 1 | 1 | 1 | 2.36ms | 9.97ms | Benchmark::Perl::Formance::BEGIN@12 |
| 1 | 1 | 1 | 1.41ms | 1.44ms | Benchmark::Perl::Formance::BEGIN@5 |
| 1 | 1 | 1 | 1.36ms | 2.21ms | Benchmark::Perl::Formance::BEGIN@9 |
| 1 | 1 | 1 | 604µs | 4.50ms | Benchmark::Perl::Formance::BEGIN@21 |
| 1 | 1 | 1 | 543µs | 656µs | Benchmark::Perl::Formance::BEGIN@13 |
| 1 | 1 | 1 | 463µs | 866µs | Benchmark::Perl::Formance::BEGIN@22 |
| 1 | 1 | 1 | 449µs | 669µs | Benchmark::Perl::Formance::BEGIN@20 |
| 1 | 1 | 1 | 436µs | 826µs | Benchmark::Perl::Formance::BEGIN@14 |
| 1 | 1 | 1 | 430µs | 1.07ms | Benchmark::Perl::Formance::BEGIN@8 |
| 1 | 1 | 1 | 387µs | 53.3ms | Benchmark::Perl::Formance::BEGIN@17 |
| 1 | 1 | 1 | 365µs | 365µs | Benchmark::Perl::Formance::CORE:open (opcode) |
| 1 | 1 | 1 | 274µs | 336µs | Benchmark::Perl::Formance::BEGIN@15 |
| 1 | 1 | 1 | 238µs | 268µs | Benchmark::Perl::Formance::BEGIN@6 |
| 1 | 1 | 1 | 218µs | 7.70ms | Benchmark::Perl::Formance::find_interesting_result_paths |
| 1 | 1 | 1 | 208µs | 471µs | Benchmark::Perl::Formance::BEGIN@16 |
| 1 | 1 | 1 | 191µs | 5.55s | Benchmark::Perl::Formance::run |
| 1 | 1 | 1 | 113µs | 10.2ms | Benchmark::Perl::Formance::print_outstyle_summary |
| 2 | 2 | 1 | 65µs | 65µs | Benchmark::Perl::Formance::CORE:sort (opcode) |
| 2 | 1 | 1 | 51µs | 51µs | Benchmark::Perl::Formance::CORE:print (opcode) |
| 1 | 1 | 1 | 32µs | 10.2ms | Benchmark::Perl::Formance::print_results |
| 1 | 1 | 1 | 24µs | 24µs | Benchmark::Perl::Formance::BEGIN@3 |
| 2 | 2 | 1 | 20µs | 20µs | Benchmark::Perl::Formance::CORE:close (opcode) |
| 2 | 2 | 1 | 10µs | 10µs | Benchmark::Perl::Formance::CORE:qr (opcode) |
| 1 | 1 | 1 | 10µs | 10µs | Benchmark::Perl::Formance::new |
| 1 | 1 | 1 | 10µs | 19µs | Benchmark::Perl::Formance::BEGIN@155 |
| 1 | 1 | 1 | 9µs | 21µs | Benchmark::Perl::Formance::BEGIN@265 |
| 1 | 1 | 1 | 9µs | 35µs | Benchmark::Perl::Formance::BEGIN@19 |
| 1 | 1 | 1 | 8µs | 18µs | Benchmark::Perl::Formance::BEGIN@478 |
| 2 | 2 | 1 | 8µs | 8µs | Benchmark::Perl::Formance::CORE:match (opcode) |
| 1 | 1 | 1 | 8µs | 18µs | Benchmark::Perl::Formance::BEGIN@723 |
| 1 | 1 | 1 | 8µs | 17µs | Benchmark::Perl::Formance::BEGIN@261 |
| 1 | 1 | 1 | 7µs | 18µs | Benchmark::Perl::Formance::BEGIN@10 |
| 1 | 1 | 1 | 7µs | 7µs | Benchmark::Perl::Formance::prepare_fast_system |
| 2 | 2 | 1 | 3µs | 3µs | Benchmark::Perl::Formance::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 3µs | 3µs | Benchmark::Perl::Formance::prepare_stable_system |
| 1 | 1 | 1 | 1µs | 1µs | Benchmark::Perl::Formance::CORE:subst (opcode) |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::__ANON__[lib/Benchmark/Perl/Formance.pm:168] |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::__ANON__[lib/Benchmark/Perl/Formance.pm:675] |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_codespeed_meta |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_get_bootstrap_perl_meta |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_get_hostname |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_get_perl_config |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_get_perl_config_v |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_get_perlformance_config |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_get_platforminfo |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_get_sysinfo |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_perl_gitdescribe |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_perl_gitversion |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_perl_symbolic_name |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::_plugin_results |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::augment_results_with_meta |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::do_disk_sync |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::generate_BenchmarkAnythingData_data |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::generate_codespeed_data |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::load_all_plugins |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::print_outstyle_json |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::print_outstyle_yaml |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::print_version |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::restore_stable_system |
| 0 | 0 | 0 | 0s | 0s | Benchmark::Perl::Formance::usage |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Benchmark::Perl::Formance; | ||||
| 2 | |||||
| 3 | 2 | 53µs | 1 | 24µs | # spent 24µs within Benchmark::Perl::Formance::BEGIN@3 which was called:
# once (24µs+0s) by main::BEGIN@5 at line 3 # spent 24µs making 1 call to Benchmark::Perl::Formance::BEGIN@3 |
| 4 | |||||
| 5 | 2 | 1.32ms | 2 | 1.45ms | # spent 1.44ms (1.41+27µs) within Benchmark::Perl::Formance::BEGIN@5 which was called:
# once (1.41ms+27µs) by main::BEGIN@5 at line 5 # spent 1.44ms making 1 call to Benchmark::Perl::Formance::BEGIN@5
# spent 6µs making 1 call to warnings::import |
| 6 | 2 | 237µs | 2 | 286µs | # spent 268µs (238+30) within Benchmark::Perl::Formance::BEGIN@6 which was called:
# once (238µs+30µs) by main::BEGIN@5 at line 6 # spent 268µs making 1 call to Benchmark::Perl::Formance::BEGIN@6
# spent 17µs making 1 call to strict::import |
| 7 | |||||
| 8 | 2 | 79µs | 2 | 1.08ms | # spent 1.07ms (430µs+638µs) within Benchmark::Perl::Formance::BEGIN@8 which was called:
# once (430µs+638µs) by main::BEGIN@5 at line 8 # spent 1.07ms making 1 call to Benchmark::Perl::Formance::BEGIN@8
# spent 10µs making 1 call to Config::import |
| 9 | 2 | 108µs | 2 | 2.23ms | # spent 2.21ms (1.36+853µs) within Benchmark::Perl::Formance::BEGIN@9 which was called:
# once (1.36ms+853µs) by main::BEGIN@5 at line 9 # spent 2.21ms making 1 call to Benchmark::Perl::Formance::BEGIN@9
# spent 15µs making 1 call to Exporter::import |
| 10 | 2 | 20µs | 2 | 28µs | # spent 18µs (7+10) within Benchmark::Perl::Formance::BEGIN@10 which was called:
# once (7µs+10µs) by main::BEGIN@5 at line 10 # spent 18µs making 1 call to Benchmark::Perl::Formance::BEGIN@10
# spent 10µs making 1 call to Exporter::import |
| 11 | 2 | 86µs | 2 | 24.4ms | # spent 23.0ms (6.06+16.9) within Benchmark::Perl::Formance::BEGIN@11 which was called:
# once (6.06ms+16.9ms) by main::BEGIN@5 at line 11 # spent 23.0ms making 1 call to Benchmark::Perl::Formance::BEGIN@11
# spent 1.42ms making 1 call to Getopt::Long::import |
| 12 | 2 | 88µs | 2 | 10.0ms | # spent 9.97ms (2.36+7.62) within Benchmark::Perl::Formance::BEGIN@12 which was called:
# once (2.36ms+7.62ms) by main::BEGIN@5 at line 12 # spent 9.97ms making 1 call to Benchmark::Perl::Formance::BEGIN@12
# spent 48µs making 1 call to Exporter::import |
| 13 | 2 | 80µs | 1 | 656µs | # spent 656µs (543+112) within Benchmark::Perl::Formance::BEGIN@13 which was called:
# once (543µs+112µs) by main::BEGIN@5 at line 13 # spent 656µs making 1 call to Benchmark::Perl::Formance::BEGIN@13 |
| 14 | 2 | 88µs | 2 | 986µs | # spent 826µs (436+389) within Benchmark::Perl::Formance::BEGIN@14 which was called:
# once (436µs+389µs) by main::BEGIN@5 at line 14 # spent 826µs making 1 call to Benchmark::Perl::Formance::BEGIN@14
# spent 160µs making 1 call to Time::HiRes::import |
| 15 | 2 | 77µs | 1 | 336µs | # spent 336µs (274+62) within Benchmark::Perl::Formance::BEGIN@15 which was called:
# once (274µs+62µs) by main::BEGIN@5 at line 15 # spent 336µs making 1 call to Benchmark::Perl::Formance::BEGIN@15 |
| 16 | 2 | 76µs | 2 | 478µs | # spent 471µs (208+262) within Benchmark::Perl::Formance::BEGIN@16 which was called:
# once (208µs+262µs) by main::BEGIN@5 at line 16 # spent 471µs making 1 call to Benchmark::Perl::Formance::BEGIN@16
# spent 7µs making 1 call to List::Util::import |
| 17 | 2 | 88µs | 2 | 53.5ms | # spent 53.3ms (387µs+52.9) within Benchmark::Perl::Formance::BEGIN@17 which was called:
# once (387µs+52.9ms) by main::BEGIN@5 at line 17 # spent 53.3ms making 1 call to Benchmark::Perl::Formance::BEGIN@17
# spent 163µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337] |
| 18 | 2 | 91µs | 2 | 7.13ms | # spent 7.10ms (6.45+643µs) within Benchmark::Perl::Formance::BEGIN@18 which was called:
# once (6.45ms+643µs) by main::BEGIN@5 at line 18 # spent 7.10ms making 1 call to Benchmark::Perl::Formance::BEGIN@18
# spent 38µs making 1 call to Exporter::import |
| 19 | 2 | 22µs | 2 | 62µs | # spent 35µs (9+27) within Benchmark::Perl::Formance::BEGIN@19 which was called:
# once (9µs+27µs) by main::BEGIN@5 at line 19 # spent 35µs making 1 call to Benchmark::Perl::Formance::BEGIN@19
# spent 27µs making 1 call to Exporter::import |
| 20 | 2 | 74µs | 2 | 691µs | # spent 669µs (449+221) within Benchmark::Perl::Formance::BEGIN@20 which was called:
# once (449µs+221µs) by main::BEGIN@5 at line 20 # spent 669µs making 1 call to Benchmark::Perl::Formance::BEGIN@20
# spent 21µs making 1 call to Exporter::import |
| 21 | 2 | 71µs | 2 | 4.50ms | # spent 4.50ms (604µs+3.89) within Benchmark::Perl::Formance::BEGIN@21 which was called:
# once (604µs+3.89ms) by main::BEGIN@5 at line 21 # spent 4.50ms making 1 call to Benchmark::Perl::Formance::BEGIN@21
# spent 5µs making 1 call to Sys::Info::import |
| 22 | 2 | 261µs | 2 | 946µs | # spent 866µs (463+402) within Benchmark::Perl::Formance::BEGIN@22 which was called:
# once (463µs+402µs) by main::BEGIN@5 at line 22 # spent 866µs making 1 call to Benchmark::Perl::Formance::BEGIN@22
# spent 81µs making 1 call to Exporter::import |
| 23 | |||||
| 24 | # comma separated list of default plugins | ||||
| 25 | 1 | 2µs | my $DEFAULT_PLUGINS = join ",", qw(DPath | ||
| 26 | Fib | ||||
| 27 | FibOO | ||||
| 28 | Mem | ||||
| 29 | Prime | ||||
| 30 | Rx | ||||
| 31 | Shootout::fasta | ||||
| 32 | Shootout::regexdna | ||||
| 33 | Shootout::binarytrees | ||||
| 34 | Shootout::revcomp | ||||
| 35 | Shootout::nbody | ||||
| 36 | Shootout::spectralnorm | ||||
| 37 | ); | ||||
| 38 | |||||
| 39 | # FibMXDeclare | ||||
| 40 | 1 | 2µs | my $ALL_PLUGINS = join ",", qw(DPath | ||
| 41 | Fib | ||||
| 42 | FibMoose | ||||
| 43 | FibMouse | ||||
| 44 | FibOO | ||||
| 45 | Mem | ||||
| 46 | P6STD | ||||
| 47 | PerlCritic | ||||
| 48 | Prime | ||||
| 49 | RegexpCommonTS | ||||
| 50 | Rx | ||||
| 51 | RxCmp | ||||
| 52 | Shootout::binarytrees | ||||
| 53 | Shootout::fannkuch | ||||
| 54 | Shootout::fasta | ||||
| 55 | Shootout::knucleotide | ||||
| 56 | Shootout::mandelbrot | ||||
| 57 | Shootout::nbody | ||||
| 58 | Shootout::pidigits | ||||
| 59 | Shootout::regexdna | ||||
| 60 | Shootout::revcomp | ||||
| 61 | Shootout::spectralnorm | ||||
| 62 | SpamAssassin | ||||
| 63 | Threads | ||||
| 64 | ThreadsShared | ||||
| 65 | ); | ||||
| 66 | |||||
| 67 | 1 | 800ns | our $scaling_script = "$Bin/benchmark-perlformance-set-stable-system"; | ||
| 68 | |||||
| 69 | 1 | 200ns | our $DEFAULT_INDENT = 0; | ||
| 70 | |||||
| 71 | 1 | 100ns | my @run_plugins; | ||
| 72 | |||||
| 73 | # incrementaly interesting Perl Config keys | ||||
| 74 | 1 | 1.79ms | 1112 | 3.01ms | my %CONFIG_KEYS = ( # spent 1.52ms making 1110 calls to Config::NEXTKEY, avg 1µs/call
# spent 1.42ms making 1 call to Config::AUTOLOAD
# spent 62µs making 1 call to Benchmark::Perl::Formance::CORE:sort |
| 75 | 0 => [], | ||||
| 76 | 1 => [ | ||||
| 77 | qw(perlpath | ||||
| 78 | version | ||||
| 79 | archname | ||||
| 80 | archname64 | ||||
| 81 | osvers | ||||
| 82 | usethreads | ||||
| 83 | useithreads | ||||
| 84 | )], | ||||
| 85 | 2 => [ | ||||
| 86 | qw(gccversion | ||||
| 87 | gnulibc_version | ||||
| 88 | usemymalloc | ||||
| 89 | config_args | ||||
| 90 | optimize | ||||
| 91 | )], | ||||
| 92 | 3 => [qw(ccflags | ||||
| 93 | ccname | ||||
| 94 | cccdlflags | ||||
| 95 | ccdlflags | ||||
| 96 | cppflags | ||||
| 97 | nm_so_opt | ||||
| 98 | )], | ||||
| 99 | 4 => [qw(PERL_REVISION | ||||
| 100 | PERL_VERSION | ||||
| 101 | PERL_SUBVERSION | ||||
| 102 | PERL_PATCHLEVEL | ||||
| 103 | |||||
| 104 | api_revision | ||||
| 105 | api_version | ||||
| 106 | api_subversion | ||||
| 107 | api_versionstring | ||||
| 108 | |||||
| 109 | gnulibc_version | ||||
| 110 | dtrace | ||||
| 111 | doublesize | ||||
| 112 | alignbytes | ||||
| 113 | bin_ELF | ||||
| 114 | git_commit_date | ||||
| 115 | version_patchlevel_string | ||||
| 116 | d_mymalloc | ||||
| 117 | |||||
| 118 | i16size | ||||
| 119 | i16type | ||||
| 120 | i32size | ||||
| 121 | i32type | ||||
| 122 | i64size | ||||
| 123 | i64type | ||||
| 124 | i8size | ||||
| 125 | i8type | ||||
| 126 | |||||
| 127 | longdblsize | ||||
| 128 | longlongsize | ||||
| 129 | longsize | ||||
| 130 | |||||
| 131 | perllibs | ||||
| 132 | ptrsize | ||||
| 133 | quadkind | ||||
| 134 | quadtype | ||||
| 135 | randbits | ||||
| 136 | )], | ||||
| 137 | 5 => [ | ||||
| 138 | sort keys %Config | ||||
| 139 | ], | ||||
| 140 | ); | ||||
| 141 | |||||
| 142 | # spent 10µs within Benchmark::Perl::Formance::new which was called:
# once (10µs+0s) by main::RUNTIME at line 7 of bin/benchmark-perlformance | ||||
| 143 | 1 | 2µs | my ($class, %args) = @_; | ||
| 144 | 1 | 11µs | bless { %args }, $class; | ||
| 145 | } | ||||
| 146 | |||||
| 147 | sub load_all_plugins | ||||
| 148 | { | ||||
| 149 | my $path = __FILE__; | ||||
| 150 | $path =~ s,\.pmc?$,/Plugin,; | ||||
| 151 | |||||
| 152 | my %all_plugins; | ||||
| 153 | finddepth ({ no_chdir => 1, | ||||
| 154 | follow => 1, | ||||
| 155 | 2 | 351µs | 2 | 28µs | # spent 19µs (10+9) within Benchmark::Perl::Formance::BEGIN@155 which was called:
# once (10µs+9µs) by main::BEGIN@5 at line 155 # spent 19µs making 1 call to Benchmark::Perl::Formance::BEGIN@155
# spent 9µs making 1 call to strict::unimport |
| 156 | my $fullname = $File::Find::fullname; | ||||
| 157 | my $plugin = $File::Find::name; | ||||
| 158 | $plugin =~ s,^$path/*,,; | ||||
| 159 | $plugin =~ s,/,::,; | ||||
| 160 | $plugin =~ s,\.pmc?$,,; | ||||
| 161 | |||||
| 162 | my $module = "Benchmark::Perl::Formance::Plugin::$plugin"; | ||||
| 163 | # eval { require $fullname }; | ||||
| 164 | eval "use $module"; ## no critic | ||||
| 165 | my $version = $@ ? "~" : ${$module."::VERSION"}; | ||||
| 166 | $all_plugins{$plugin} = $version | ||||
| 167 | if -f $fullname && $fullname =~ /\.pmc?$/; | ||||
| 168 | }, | ||||
| 169 | }, | ||||
| 170 | $path); | ||||
| 171 | return %all_plugins; | ||||
| 172 | } | ||||
| 173 | |||||
| 174 | sub print_version | ||||
| 175 | { | ||||
| 176 | my ($self) = @_; | ||||
| 177 | |||||
| 178 | if ($self->{options}{verbose}) | ||||
| 179 | { | ||||
| 180 | print "Benchmark::Perl::Formance version $Benchmark::Perl::Formance::VERSION\n"; | ||||
| 181 | print "Plugins:\n"; | ||||
| 182 | my %plugins = load_all_plugins; | ||||
| 183 | print " (v$plugins{$_}) $_\n" foreach sort keys %plugins; | ||||
| 184 | } | ||||
| 185 | else | ||||
| 186 | { | ||||
| 187 | print $Benchmark::Perl::Formance::VERSION, "\n"; | ||||
| 188 | } | ||||
| 189 | } | ||||
| 190 | |||||
| 191 | sub usage | ||||
| 192 | { | ||||
| 193 | print 'benchmark-perlformance - Frontend for Benchmark::Perl::Formance | ||||
| 194 | |||||
| 195 | Usage: | ||||
| 196 | |||||
| 197 | $ benchmark-perlformance | ||||
| 198 | $ benchmark-perlformance --fastmode | ||||
| 199 | $ benchmark-perlformance --useforks | ||||
| 200 | $ benchmark-perlformance --plugins=SpamAssassin,RegexpCommonTS,RxCmp -v | ||||
| 201 | $ benchmark-perlformance -ccccc --indent=2 | ||||
| 202 | $ benchmark-perlformance -q | ||||
| 203 | |||||
| 204 | If run directly it uses the perl in your PATH: | ||||
| 205 | |||||
| 206 | $ /path/to/benchmark-perlformance | ||||
| 207 | |||||
| 208 | To use another perl start it via | ||||
| 209 | |||||
| 210 | $ /other/path/to/bin/perl /path/to/benchmark-perlformance | ||||
| 211 | |||||
| 212 | For more details see | ||||
| 213 | |||||
| 214 | man benchmark-perlformance | ||||
| 215 | perldoc Benchmark::Perl::Formance | ||||
| 216 | |||||
| 217 | '; | ||||
| 218 | } | ||||
| 219 | |||||
| 220 | sub do_disk_sync { | ||||
| 221 | system("sync ; sync"); | ||||
| 222 | } | ||||
| 223 | |||||
| 224 | sub prepare_stable_system | ||||
| 225 | # spent 3µs within Benchmark::Perl::Formance::prepare_stable_system which was called:
# once (3µs+0s) by Benchmark::Perl::Formance::run at line 617 | ||||
| 226 | 1 | 600ns | my ($self) = @_; | ||
| 227 | |||||
| 228 | 1 | 200ns | my $orig_values; | ||
| 229 | 1 | 4µs | if ($self->{options}{stabilize_cpu} and $^O eq "linux") { | ||
| 230 | $self->{orig_system_values} = qx(sudo $scaling_script lo); | ||||
| 231 | do_disk_sync(); | ||||
| 232 | } | ||||
| 233 | } | ||||
| 234 | |||||
| 235 | sub restore_stable_system | ||||
| 236 | { | ||||
| 237 | my ($self, $orig_values) = @_; | ||||
| 238 | if ($self->{options}{stabilize_cpu} and $^O eq "linux") { | ||||
| 239 | if (open my $RESTORE, "|-", "sudo $scaling_script restore") { | ||||
| 240 | print $RESTORE $self->{orig_system_values}; | ||||
| 241 | close $RESTORE; | ||||
| 242 | } | ||||
| 243 | } | ||||
| 244 | } | ||||
| 245 | |||||
| 246 | sub prepare_fast_system | ||||
| 247 | # spent 7µs within Benchmark::Perl::Formance::prepare_fast_system which was called:
# once (7µs+0s) by Benchmark::Perl::Formance::run at line 624 | ||||
| 248 | 1 | 900ns | my ($self) = @_; | ||
| 249 | |||||
| 250 | 1 | 300ns | my $orig_values; | ||
| 251 | 1 | 9µs | if ($self->{options}{stabilize_cpu} and $^O eq "linux") { | ||
| 252 | $self->{orig_system_values} = qx(sudo $scaling_script hi); | ||||
| 253 | } | ||||
| 254 | } | ||||
| 255 | |||||
| 256 | sub run_plugin | ||||
| 257 | # spent 5.54s (97.4ms+5.45) within Benchmark::Perl::Formance::run_plugin which was called:
# once (97.4ms+5.45s) by Benchmark::Perl::Formance::run at line 621 | ||||
| 258 | 1 | 1µs | my ($self, $pluginname) = @_; | ||
| 259 | |||||
| 260 | 1 | 8µs | 1 | 1µs | $pluginname =~ s,\.,::,g; # spent 1µs making 1 call to Benchmark::Perl::Formance::CORE:subst |
| 261 | 2 | 49µs | 2 | 26µs | # spent 17µs (8+9) within Benchmark::Perl::Formance::BEGIN@261 which was called:
# once (8µs+9µs) by main::BEGIN@5 at line 261 # spent 17µs making 1 call to Benchmark::Perl::Formance::BEGIN@261
# spent 9µs making 1 call to strict::unimport |
| 262 | 1 | 1µs | print STDERR "# Run $pluginname...\n" if $self->{options}{verbose} >= 2; | ||
| 263 | 1 | 200ns | my $res; | ||
| 264 | 1 | 2µs | eval { | ||
| 265 | 2 | 899µs | 2 | 33µs | # spent 21µs (9+12) within Benchmark::Perl::Formance::BEGIN@265 which was called:
# once (9µs+12µs) by main::BEGIN@5 at line 265 # spent 21µs making 1 call to Benchmark::Perl::Formance::BEGIN@265
# spent 12µs making 1 call to Exporter::import |
| 266 | 1 | 15µs | pipe(PARENT_RDR, CHILD_WTR); | ||
| 267 | 1 | 14µs | 2 | 78µs | CHILD_WTR->autoflush(1); # spent 69µs making 1 call to IO::Handle::autoflush
# spent 9µs making 1 call to SelectSaver::DESTROY |
| 268 | 1 | 438µs | 1 | 365µs | my $pid = open(my $PLUGIN, "-|"); # implicit fork # spent 365µs making 1 call to Benchmark::Perl::Formance::CORE:open |
| 269 | 1 | 400ns | if ($pid == 0) { | ||
| 270 | # run in child process | ||||
| 271 | close PARENT_RDR; | ||||
| 272 | eval "use Benchmark::Perl::Formance::Plugin::$pluginname"; ## no critic | ||||
| 273 | if ($@) { | ||||
| 274 | my @errors = split qr/\n/, $@; | ||||
| 275 | my $maxerr = ($#errors < 10) ? $#errors : 10; | ||||
| 276 | print STDERR "# Skip plugin '$pluginname'" if $self->{options}{verbose}; | ||||
| 277 | print STDERR ":".$errors[0] if $self->{options}{verbose} > 1; | ||||
| 278 | print STDERR join("\n# ", "", @errors[1..$maxerr]) if $self->{options}{verbose} > 2; | ||||
| 279 | print STDERR "\n" if $self->{options}{verbose}; | ||||
| 280 | exit 0; | ||||
| 281 | } | ||||
| 282 | $0 = "benchmark-perl-formance-$pluginname"; | ||||
| 283 | $res = &{"Benchmark::Perl::Formance::Plugin::${pluginname}::main"}($self->{options}); | ||||
| 284 | $res->{PLUGIN_VERSION} = ${"Benchmark::Perl::Formance::Plugin::${pluginname}::VERSION"}; | ||||
| 285 | store_fd($res, \*CHILD_WTR); | ||||
| 286 | close CHILD_WTR; | ||||
| 287 | exit 0; | ||||
| 288 | } | ||||
| 289 | 1 | 25µs | 1 | 8µs | close CHILD_WTR; # spent 8µs making 1 call to Benchmark::Perl::Formance::CORE:close |
| 290 | 1 | 33µs | 1 | 5.45s | $res = fd_retrieve(\*PARENT_RDR); # spent 5.45s making 1 call to Storable::fd_retrieve |
| 291 | 1 | 97.3ms | 1 | 11µs | close PARENT_RDR; # spent 11µs making 1 call to Benchmark::Perl::Formance::CORE:close |
| 292 | }; | ||||
| 293 | 1 | 400ns | if ($@) { | ||
| 294 | $res = { | ||||
| 295 | failed => "Plugin $pluginname failed", | ||||
| 296 | ($self->{options}{verbose} > 3 ? ( error => $@ ) : ()), | ||||
| 297 | } | ||||
| 298 | } | ||||
| 299 | 1 | 20µs | return $res; | ||
| 300 | } | ||||
| 301 | |||||
| 302 | # That's specific to the Tapper wrapper around | ||||
| 303 | # Benchmark::Perl::Formance and should be replaced | ||||
| 304 | # with something generic | ||||
| 305 | sub _perl_gitversion { | ||||
| 306 | my $perlpath = "$^X"; | ||||
| 307 | $perlpath =~ s,/[^/]*$,,; | ||||
| 308 | my $perl_gitversion = "$perlpath/perl -MConfig -e 'print \$Config{bootstrap_perl_git_changeset}"; | ||||
| 309 | |||||
| 310 | if (-x $perl_gitversion) { | ||||
| 311 | my $gitversion = qx!$perl_gitversion! ; | ||||
| 312 | chomp $gitversion; | ||||
| 313 | return $gitversion; | ||||
| 314 | } | ||||
| 315 | } | ||||
| 316 | |||||
| 317 | sub _perl_gitdescribe { | ||||
| 318 | my $perlpath = "$^X"; | ||||
| 319 | $perlpath =~ s,/[^/]*$,,; | ||||
| 320 | my $perl_gitdescribe = "$perlpath/perl -MConfig -e 'print \$Config{bootstrap_perl_git_describe}"; | ||||
| 321 | |||||
| 322 | if (-x $perl_gitdescribe) { | ||||
| 323 | my $gitdescribe = qx!$perl_gitdescribe! ; | ||||
| 324 | chomp $gitdescribe; | ||||
| 325 | return $gitdescribe; | ||||
| 326 | } | ||||
| 327 | } | ||||
| 328 | |||||
| 329 | sub _perl_symbolic_name { | ||||
| 330 | my $perlpath = "$^X"; | ||||
| 331 | $perlpath =~ s,/[^/]*$,,; | ||||
| 332 | my $perl_symbolic_name = "$perlpath/perl -MConfig -e 'print \$Config{bootstrap_perl_symbolic_name}"; | ||||
| 333 | |||||
| 334 | if (-x $perl_symbolic_name) { | ||||
| 335 | my $executable = qx!$perl_symbolic_name! ; | ||||
| 336 | chomp $executable; | ||||
| 337 | return $executable; | ||||
| 338 | } | ||||
| 339 | } | ||||
| 340 | |||||
| 341 | sub _get_hostname { | ||||
| 342 | my $host = "unknown-hostname"; | ||||
| 343 | eval { $host = hostname }; | ||||
| 344 | $host = "perl64.org" if $host eq "h1891504"; # special case for PerlFormance.Net Æsthetics | ||||
| 345 | return $host; | ||||
| 346 | } | ||||
| 347 | |||||
| 348 | sub _plugin_results { | ||||
| 349 | my ($self, $plugin, $RESULTS) = @_; | ||||
| 350 | |||||
| 351 | my @resultkeys = split(/\./, $plugin); | ||||
| 352 | my ($res) = dpath("/results/".join("/", map { qq("$_") } @resultkeys)."/Benchmark/*[0]")->match($RESULTS); | ||||
| 353 | |||||
| 354 | return $res; | ||||
| 355 | } | ||||
| 356 | |||||
| 357 | sub _codespeed_meta { | ||||
| 358 | my ($self, $RESULTS) = @_; | ||||
| 359 | |||||
| 360 | my $codespeed_exe_suffix = $self->{options}{cs_executable_suffix} || $ENV{CODESPEED_EXE_SUFFIX} || ""; | ||||
| 361 | my $codespeed_exe = $self->{options}{cs_executable} || _perl_symbolic_name || sprintf("perl-%s.%s%s", | ||||
| 362 | $Config{PERL_REVISION}, | ||||
| 363 | $Config{PERL_VERSION}, | ||||
| 364 | $codespeed_exe_suffix, | ||||
| 365 | ); | ||||
| 366 | my $codespeed_project = $self->{options}{cs_project} || $ENV{CODESPEED_PROJECT} || "perl5"; | ||||
| 367 | my $codespeed_branch = $self->{options}{cs_branch} || $ENV{CODESPEED_BRANCH} || "default"; | ||||
| 368 | my $codespeed_commitid = $self->{options}{cs_commitid} || $ENV{CODESPEED_COMMITID} || $Config{git_commit_id} || _perl_gitversion || "no-commit"; | ||||
| 369 | my $codespeed_environment = $self->{options}{cs_environment} || $ENV{CODESPEED_ENVIRONMENT} || _get_hostname || "no-env"; | ||||
| 370 | my %codespeed_meta = ( | ||||
| 371 | executable => $codespeed_exe, | ||||
| 372 | project => $codespeed_project, | ||||
| 373 | branch => $codespeed_branch, | ||||
| 374 | commitid => $codespeed_commitid, | ||||
| 375 | environment => $codespeed_environment, | ||||
| 376 | ); | ||||
| 377 | |||||
| 378 | return %codespeed_meta; | ||||
| 379 | } | ||||
| 380 | |||||
| 381 | sub _get_bootstrap_perl_meta { | ||||
| 382 | my ($self) = @_; | ||||
| 383 | |||||
| 384 | return map { ("$_" => $Config{$_}) } grep { /^bootstrap_perl/ } keys %Config; | ||||
| 385 | } | ||||
| 386 | |||||
| 387 | sub _get_perl_config { | ||||
| 388 | my ($self) = @_; | ||||
| 389 | |||||
| 390 | my @cfgkeys; | ||||
| 391 | my $showconfig = 4; | ||||
| 392 | push @cfgkeys, @{$CONFIG_KEYS{$_}} foreach 1..$showconfig; | ||||
| 393 | return map { ("perlconfig_$_" => $Config{$_}) } @cfgkeys; | ||||
| 394 | } | ||||
| 395 | |||||
| 396 | sub _get_perl_config_v { | ||||
| 397 | my ($self) = @_; | ||||
| 398 | |||||
| 399 | # only when ultimate verbose config requested | ||||
| 400 | return unless $self->{options}{showconfig} >= 5; | ||||
| 401 | |||||
| 402 | my $config_v_myconfig = Config::Perl::V::myconfig (); | ||||
| 403 | my @config_v_keys = sort keys %$config_v_myconfig; | ||||
| 404 | |||||
| 405 | # --- flat configs --- | ||||
| 406 | my $prefix = "perlconfigv"; | ||||
| 407 | my %perlconfigv = (); | ||||
| 408 | my %focus = ( | ||||
| 409 | derived => [ qw( Off_t uname) ], | ||||
| 410 | build => [ qw( osname stamp ) ], | ||||
| 411 | environment => [ keys %{$config_v_myconfig->{environment}} ], # all | ||||
| 412 | ); | ||||
| 413 | foreach my $subcfg (keys %focus) { | ||||
| 414 | foreach my $k (@{$focus{$subcfg}}) { | ||||
| 415 | $perlconfigv{join("_", $prefix, $subcfg, $k)} = $config_v_myconfig->{$subcfg}{$k}; | ||||
| 416 | } | ||||
| 417 | } | ||||
| 418 | |||||
| 419 | # --- nested configs --- | ||||
| 420 | |||||
| 421 | # build options | ||||
| 422 | my @buildoptionkeys = keys %{$config_v_myconfig->{build}{options}}; | ||||
| 423 | foreach my $k (keys %focus) { | ||||
| 424 | $perlconfigv{join("_", $prefix, "build", "options", $k)} = $config_v_myconfig->{build}{options}{$k}; | ||||
| 425 | } | ||||
| 426 | |||||
| 427 | return %perlconfigv; | ||||
| 428 | } | ||||
| 429 | |||||
| 430 | sub _get_perlformance_config { | ||||
| 431 | my ($self) = @_; | ||||
| 432 | |||||
| 433 | # only easy printable data (i.e., no "D" hash) | ||||
| 434 | my @config_keys = (qw(stabilize_cpu | ||||
| 435 | fastmode | ||||
| 436 | useforks | ||||
| 437 | plugins | ||||
| 438 | )); | ||||
| 439 | |||||
| 440 | return map { $self->{options}{$_} ? ("perlformance_$_" => $self->{options}{$_}) : () } @config_keys; | ||||
| 441 | } | ||||
| 442 | |||||
| 443 | sub _get_platforminfo { | ||||
| 444 | my ($self) = @_; | ||||
| 445 | |||||
| 446 | my $get_info = Devel::Platform::Info->new->get_info; | ||||
| 447 | delete $get_info->{source}; # this currently breaks the simplified YAMLish | ||||
| 448 | return %$get_info; | ||||
| 449 | } | ||||
| 450 | |||||
| 451 | sub _get_sysinfo { | ||||
| 452 | my ($self) = @_; | ||||
| 453 | |||||
| 454 | my %sysinfo = (); | ||||
| 455 | my $prefix = "sysinfo"; | ||||
| 456 | my $cpu = (Sys::Info->new->device("CPU")->identify)[0]; | ||||
| 457 | $sysinfo{join("_", $prefix, "cpu", $_)} = $cpu->{$_} foreach qw(name | ||||
| 458 | family | ||||
| 459 | model | ||||
| 460 | stepping | ||||
| 461 | architecture | ||||
| 462 | number_of_cores | ||||
| 463 | number_of_logical_processors | ||||
| 464 | architecture | ||||
| 465 | manufacturer | ||||
| 466 | ); | ||||
| 467 | $sysinfo{join("_", $prefix, "cpu", "l2_cache", "max_cache_size")} = $cpu->{L2_cache}{max_cache_size}; | ||||
| 468 | return %sysinfo; | ||||
| 469 | } | ||||
| 470 | |||||
| 471 | sub augment_results_with_meta { | ||||
| 472 | my ($self, $NAME_KEY, $VALUE_KEY, $META, $RESULTS) = @_; | ||||
| 473 | |||||
| 474 | my @run_plugins = $self->find_interesting_result_paths($RESULTS); | ||||
| 475 | my @new_entries = (); | ||||
| 476 | my $prefix = "perlformance.perl5"; | ||||
| 477 | foreach my $plugin (sort @run_plugins) { | ||||
| 478 | 2 | 786µs | 2 | 28µs | # spent 18µs (8+10) within Benchmark::Perl::Formance::BEGIN@478 which was called:
# once (8µs+10µs) by main::BEGIN@5 at line 478 # spent 18µs making 1 call to Benchmark::Perl::Formance::BEGIN@478
# spent 10µs making 1 call to strict::unimport |
| 479 | my $res = $self->_plugin_results($plugin, $RESULTS); | ||||
| 480 | my $benchmark = join ".", $prefix, ($self->{options}{fastmode} ? "$plugin(F)" : $plugin); | ||||
| 481 | push @new_entries, { | ||||
| 482 | %$META, | ||||
| 483 | # metric name and value at last position to override | ||||
| 484 | $NAME_KEY => $benchmark, | ||||
| 485 | $VALUE_KEY => ($res || 0), | ||||
| 486 | }; | ||||
| 487 | } | ||||
| 488 | return \@new_entries; | ||||
| 489 | } | ||||
| 490 | |||||
| 491 | sub generate_codespeed_data | ||||
| 492 | { | ||||
| 493 | my ($self, $RESULTS) = @_; | ||||
| 494 | |||||
| 495 | my %META = _codespeed_meta(); | ||||
| 496 | return $self->augment_results_with_meta("benchmark", "result_value", \%META, $RESULTS); | ||||
| 497 | } | ||||
| 498 | |||||
| 499 | sub generate_BenchmarkAnythingData_data | ||||
| 500 | { | ||||
| 501 | my ($self, $RESULTS) = @_; | ||||
| 502 | |||||
| 503 | # share a common dataset with Codespeed, yet prefix it | ||||
| 504 | my %codespeed_meta = _codespeed_meta; | ||||
| 505 | my %prefixed_codespeed_meta = map { ("codespeed_$_" => $codespeed_meta{$_}) } keys %codespeed_meta; | ||||
| 506 | |||||
| 507 | my %platforminfo = $self->_get_platforminfo; | ||||
| 508 | my %prefixed_platforminfo = map { ("platforminfo_$_" => $platforminfo{$_}) } keys %platforminfo; | ||||
| 509 | |||||
| 510 | my %META = ( | ||||
| 511 | %prefixed_platforminfo, | ||||
| 512 | %prefixed_codespeed_meta, | ||||
| 513 | $self->_get_bootstrap_perl_meta, | ||||
| 514 | $self->_get_perl_config, | ||||
| 515 | $self->_get_perl_config_v, | ||||
| 516 | $self->_get_sysinfo, | ||||
| 517 | $self->_get_perlformance_config, | ||||
| 518 | ); | ||||
| 519 | return $self->augment_results_with_meta("NAME", "VALUE", \%META, $RESULTS); | ||||
| 520 | } | ||||
| 521 | |||||
| 522 | # spent 5.55s (191µs+5.55) within Benchmark::Perl::Formance::run which was called:
# once (191µs+5.55s) by main::RUNTIME at line 9 of bin/benchmark-perlformance | ||||
| 523 | 1 | 700ns | my ($self) = @_; | ||
| 524 | |||||
| 525 | 1 | 300ns | my $help = 0; | ||
| 526 | 1 | 100ns | my $showconfig = 0; | ||
| 527 | 1 | 500ns | my $outstyle = "summary"; | ||
| 528 | 1 | 100ns | my $platforminfo = 0; | ||
| 529 | 1 | 200ns | my $codespeed = 0; | ||
| 530 | 1 | 200ns | my $tapper = 0; | ||
| 531 | 1 | 300ns | my $cs_executable_suffix = ""; | ||
| 532 | 1 | 200ns | my $cs_executable = ""; | ||
| 533 | 1 | 100ns | my $cs_project = ""; | ||
| 534 | 1 | 200ns | my $cs_branch = ""; | ||
| 535 | 1 | 200ns | my $cs_commitid = ""; | ||
| 536 | 1 | 100ns | my $cs_environment = ""; | ||
| 537 | 1 | 100ns | my $verbose = 0; | ||
| 538 | 1 | 100ns | my $version = 0; | ||
| 539 | 1 | 200ns | my $fastmode = 0; | ||
| 540 | 1 | 200ns | my $useforks = 0; | ||
| 541 | 1 | 200ns | my $quiet = 0; | ||
| 542 | 1 | 100ns | my $stabilize_cpu = 0; | ||
| 543 | 1 | 400ns | my $plugins = $DEFAULT_PLUGINS; | ||
| 544 | 1 | 200ns | my $indent = $DEFAULT_INDENT; | ||
| 545 | 1 | 200ns | my $tapdescription = ""; | ||
| 546 | 1 | 400ns | my $D = {}; | ||
| 547 | |||||
| 548 | # get options | ||||
| 549 | 1 | 4µs | 1 | 6µs | my $ok = GetOptions ( # spent 6µs making 1 call to Getopt::Long::GetOptions |
| 550 | "help|h" => \$help, | ||||
| 551 | "quiet|q" => \$quiet, | ||||
| 552 | "indent=i" => \$indent, | ||||
| 553 | "plugins=s" => \$plugins, | ||||
| 554 | "verbose|v+" => \$verbose, | ||||
| 555 | "outstyle=s" => \$outstyle, | ||||
| 556 | "fastmode" => \$fastmode, | ||||
| 557 | "version" => \$version, | ||||
| 558 | "useforks" => \$useforks, | ||||
| 559 | "stabilize-cpu" => \$stabilize_cpu, | ||||
| 560 | "showconfig|c+" => \$showconfig, | ||||
| 561 | "platforminfo|p" => \$platforminfo, | ||||
| 562 | "codespeed" => \$codespeed, | ||||
| 563 | "tapper" => \$tapper, | ||||
| 564 | "cs-executable-suffix=s" => \$cs_executable_suffix, | ||||
| 565 | "cs-executable=s" => \$cs_executable, | ||||
| 566 | "cs-project=s" => \$cs_project, | ||||
| 567 | "cs-branch=s" => \$cs_branch, | ||||
| 568 | "cs-commitid=s" => \$cs_commitid, | ||||
| 569 | "cs-environment=s" => \$cs_environment, | ||||
| 570 | "tapdescription=s" => \$tapdescription, | ||||
| 571 | "D=s%" => \$D, | ||||
| 572 | ); | ||||
| 573 | # fill options | ||||
| 574 | 1 | 8µs | $self->{options} = { | ||
| 575 | help => $help, | ||||
| 576 | quiet => $quiet, | ||||
| 577 | verbose => $verbose, | ||||
| 578 | outstyle => $outstyle, | ||||
| 579 | fastmode => $fastmode, | ||||
| 580 | useforks => $useforks, | ||||
| 581 | stabilize_cpu => $stabilize_cpu, | ||||
| 582 | showconfig => $showconfig, | ||||
| 583 | platforminfo => $platforminfo, | ||||
| 584 | codespeed => $codespeed, | ||||
| 585 | tapper => $tapper, | ||||
| 586 | cs_executable_suffix => $cs_executable_suffix, | ||||
| 587 | cs_executable => $cs_executable, | ||||
| 588 | cs_project => $cs_project, | ||||
| 589 | cs_branch => $cs_branch, | ||||
| 590 | cs_commitid => $cs_commitid, | ||||
| 591 | cs_environment => $cs_environment, | ||||
| 592 | plugins => $plugins, | ||||
| 593 | tapdescription => $tapdescription, | ||||
| 594 | indent => $indent, | ||||
| 595 | D => $D, | ||||
| 596 | }; | ||||
| 597 | |||||
| 598 | 1 | 200ns | do { $self->print_version; exit 0 } if $version; | ||
| 599 | 1 | 100ns | do { usage; exit 0 } if $help; | ||
| 600 | 1 | 300ns | do { usage; exit -1 } if not $ok; | ||
| 601 | |||||
| 602 | # use forks if requested | ||||
| 603 | 1 | 200ns | if ($useforks) { | ||
| 604 | eval "use forks"; ## no critic | ||||
| 605 | $useforks = 0 if $@; | ||||
| 606 | print STDERR "# use forks " . ($@ ? "failed" : "") . "\n" if $verbose; | ||||
| 607 | } | ||||
| 608 | |||||
| 609 | # static list because dynamic require influences runtimes | ||||
| 610 | 1 | 400ns | $plugins = $ALL_PLUGINS if $plugins eq "ALL"; | ||
| 611 | |||||
| 612 | # run plugins | ||||
| 613 | 1 | 17µs | 1 | 12µs | my $before = gettimeofday(); # spent 12µs making 1 call to Time::HiRes::gettimeofday |
| 614 | 1 | 200ns | my %RESULTS; | ||
| 615 | 1 | 8µs | 1 | 1µs | my @plugins = grep /\w/, split '\s*,\s*', $plugins; # spent 1µs making 1 call to Benchmark::Perl::Formance::CORE:match |
| 616 | |||||
| 617 | 1 | 2µs | 1 | 3µs | $self->prepare_stable_system; # spent 3µs making 1 call to Benchmark::Perl::Formance::prepare_stable_system |
| 618 | 1 | 1µs | foreach (@plugins) | ||
| 619 | { | ||||
| 620 | 1 | 14µs | 2 | 3µs | my @resultkeys = split(qr/::|\./, $_); # spent 3µs making 1 call to Benchmark::Perl::Formance::CORE:qr
# spent 400ns making 1 call to Benchmark::Perl::Formance::CORE:regcomp |
| 621 | 1 | 4µs | 1 | 5.54s | my $res = $self->run_plugin($_); # spent 5.54s making 1 call to Benchmark::Perl::Formance::run_plugin |
| 622 | 1 | 70µs | eval "\$RESULTS{results}{".join("}{", @resultkeys)."} = \$res"; ## no critic # spent 6µs executing statements in string eval | ||
| 623 | } | ||||
| 624 | 1 | 6µs | 1 | 7µs | $self->prepare_fast_system; # simply set to max, as restore_stable_system() is no reliable approach anyway # spent 7µs making 1 call to Benchmark::Perl::Formance::prepare_fast_system |
| 625 | |||||
| 626 | 1 | 11µs | 1 | 3µs | my $after = gettimeofday(); # spent 3µs making 1 call to Time::HiRes::gettimeofday |
| 627 | 1 | 4µs | $RESULTS{perlformance}{overall_runtime} = $after - $before; | ||
| 628 | 1 | 4µs | $RESULTS{perlformance}{config}{fastmode} = $fastmode; | ||
| 629 | 1 | 1µs | $RESULTS{perlformance}{config}{use_forks} = $useforks; | ||
| 630 | |||||
| 631 | # Perl Config | ||||
| 632 | 1 | 300ns | if ($showconfig) | ||
| 633 | { | ||||
| 634 | # Config | ||||
| 635 | my @cfgkeys; | ||||
| 636 | push @cfgkeys, @{$CONFIG_KEYS{$_}} foreach 1..$showconfig; | ||||
| 637 | $RESULTS{perl_config} = | ||||
| 638 | { | ||||
| 639 | map { $_ => $Config{$_} } sort @cfgkeys | ||||
| 640 | }; | ||||
| 641 | |||||
| 642 | # Config::Perl::V | ||||
| 643 | $RESULTS{perl_config_v} = Config::Perl::V::myconfig; | ||||
| 644 | } | ||||
| 645 | |||||
| 646 | # Perl Config | ||||
| 647 | 1 | 400ns | if ($platforminfo) | ||
| 648 | { | ||||
| 649 | $RESULTS{platform_info} = { $self->_get_platforminfo }; | ||||
| 650 | } | ||||
| 651 | |||||
| 652 | # Codespeed data blocks | ||||
| 653 | 1 | 200ns | if ($codespeed) | ||
| 654 | { | ||||
| 655 | $RESULTS{codespeed} = $self->generate_codespeed_data(\%RESULTS); | ||||
| 656 | } | ||||
| 657 | |||||
| 658 | # Tapper BenchmarkAnythingData blocks | ||||
| 659 | 1 | 400ns | if ($tapper) | ||
| 660 | { | ||||
| 661 | $RESULTS{BenchmarkAnythingData} = $self->generate_BenchmarkAnythingData_data(\%RESULTS); | ||||
| 662 | } | ||||
| 663 | |||||
| 664 | 1 | 7µs | 1 | 53µs | unbless (\%RESULTS); # spent 53µs making 1 call to Data::Structure::Util::unbless |
| 665 | 1 | 12µs | return \%RESULTS; | ||
| 666 | } | ||||
| 667 | |||||
| 668 | sub print_outstyle_yaml | ||||
| 669 | { | ||||
| 670 | my ($self, $RESULTS) = @_; | ||||
| 671 | |||||
| 672 | my $output = ''; | ||||
| 673 | my $indent = $self->{options}{indent}; | ||||
| 674 | my $yw = new Data::YAML::Writer; | ||||
| 675 | $yw->write($RESULTS, sub { $output .= shift()."\n" }); | ||||
| 676 | $output =~ s/^/" "x$indent/emsg; # indent | ||||
| 677 | |||||
| 678 | my $tapdescription = $self->{options}{tapdescription}; | ||||
| 679 | $output = "ok $tapdescription\n".$output if $tapdescription; | ||||
| 680 | print $output; | ||||
| 681 | } | ||||
| 682 | |||||
| 683 | sub print_outstyle_json | ||||
| 684 | { | ||||
| 685 | my ($self, $RESULTS) = @_; | ||||
| 686 | |||||
| 687 | require JSON; | ||||
| 688 | my $json = JSON->new->allow_nonref; | ||||
| 689 | print $json->pretty->encode( $RESULTS ); | ||||
| 690 | } | ||||
| 691 | |||||
| 692 | sub find_interesting_result_paths | ||||
| 693 | # spent 7.70ms (218µs+7.48) within Benchmark::Perl::Formance::find_interesting_result_paths which was called:
# once (218µs+7.48ms) by Benchmark::Perl::Formance::print_outstyle_summary at line 719 | ||||
| 694 | 1 | 900ns | my ($self, $RESULTS) = @_; | ||
| 695 | |||||
| 696 | 1 | 800ns | my @all_keys = (); | ||
| 697 | |||||
| 698 | 1 | 14µs | 2 | 3.61ms | my $benchmarks = dpathi($RESULTS)->isearch("//Benchmark"); # spent 2.29ms making 1 call to Data::DPath::__ANON__[Data/DPath.pm:47]
# spent 1.32ms making 1 call to Data::DPath::Context::isearch |
| 699 | |||||
| 700 | 1 | 14µs | 3 | 15µs | while ($benchmarks->isnt_exhausted) { # spent 12µs making 2 calls to Iterator::DESTROY, avg 6µs/call
# spent 4µs making 1 call to Iterator::isnt_exhausted |
| 701 | 2 | 500ns | my @keys; | ||
| 702 | 2 | 4µs | 2 | 969µs | my $benchmark = $benchmarks->value; # spent 969µs making 2 calls to Iterator::value, avg 484µs/call |
| 703 | 2 | 8µs | 2 | 597µs | my $ancestors = $benchmark->isearch ("/::ancestor"); # spent 597µs making 2 calls to Data::DPath::Context::isearch, avg 298µs/call |
| 704 | |||||
| 705 | 2 | 5µs | 2 | 5µs | while ($ancestors->isnt_exhausted) { # spent 5µs making 2 calls to Iterator::isnt_exhausted, avg 3µs/call |
| 706 | 10 | 43µs | 20 | 2.19ms | my $key = $ancestors->value->first_point->{attrs}{key}; # spent 2.16ms making 10 calls to Iterator::value, avg 216µs/call
# spent 29µs making 10 calls to Data::DPath::Context::first_point, avg 3µs/call |
| 707 | 10 | 26µs | 10 | 23µs | push @keys, $key if defined $key; # spent 23µs making 10 calls to Iterator::isnt_exhausted, avg 2µs/call |
| 708 | } | ||||
| 709 | 2 | 900ns | pop @keys; | ||
| 710 | 2 | 15µs | 4 | 45µs | push @all_keys, join(".", reverse @keys); # spent 40µs making 2 calls to Iterator::DESTROY, avg 20µs/call
# spent 5µs making 2 calls to Iterator::isnt_exhausted, avg 2µs/call |
| 711 | } | ||||
| 712 | 1 | 2µs | return @all_keys; | ||
| 713 | } | ||||
| 714 | |||||
| 715 | sub print_outstyle_summary | ||||
| 716 | # spent 10.2ms (113µs+10.0) within Benchmark::Perl::Formance::print_outstyle_summary which was called:
# once (113µs+10.0ms) by Benchmark::Perl::Formance::print_results at line 739 | ||||
| 717 | 1 | 800ns | my ($self, $RESULTS) = @_; | ||
| 718 | |||||
| 719 | 1 | 12µs | 2 | 7.72ms | my @run_plugins = $self->find_interesting_result_paths($RESULTS); # spent 7.70ms making 1 call to Benchmark::Perl::Formance::find_interesting_result_paths
# spent 20µs making 1 call to Iterator::DESTROY |
| 720 | 1 | 11µs | 1 | 2µs | my $len = max map { length } @run_plugins; # spent 2µs making 1 call to List::Util::max |
| 721 | |||||
| 722 | 1 | 17µs | 1 | 4µs | foreach (sort @run_plugins) { # spent 4µs making 1 call to Benchmark::Perl::Formance::CORE:sort |
| 723 | 2 | 179µs | 2 | 28µs | # spent 18µs (8+10) within Benchmark::Perl::Formance::BEGIN@723 which was called:
# once (8µs+10µs) by main::BEGIN@5 at line 723 # spent 18µs making 1 call to Benchmark::Perl::Formance::BEGIN@723
# spent 10µs making 1 call to strict::unimport |
| 724 | 2 | 7µs | my @resultkeys = split(/\./); | ||
| 725 | 2 | 35µs | 4 | 2.29ms | my ($res) = dpath("/results/".join("/", map { qq("$_") } @resultkeys)."/Benchmark/*[0]")->match($RESULTS); # spent 1.65ms making 2 calls to Data::DPath::__ANON__[Data/DPath.pm:27], avg 824µs/call
# spent 640µs making 2 calls to Data::DPath::Path::match, avg 320µs/call |
| 726 | 2 | 85µs | 2 | 51µs | print sprintf("%-${len}s : %f\n", $_, ($res || 0)); # spent 51µs making 2 calls to Benchmark::Perl::Formance::CORE:print, avg 26µs/call |
| 727 | } | ||||
| 728 | } | ||||
| 729 | |||||
| 730 | sub print_results | ||||
| 731 | # spent 10.2ms (32µs+10.2) within Benchmark::Perl::Formance::print_results which was called:
# once (32µs+10.2ms) by main::RUNTIME at line 10 of bin/benchmark-perlformance | ||||
| 732 | 1 | 1µs | my ($self, $RESULTS) = @_; | ||
| 733 | 1 | 900ns | return if $self->{options}{quiet}; | ||
| 734 | |||||
| 735 | 1 | 1µs | my $outstyle = $self->{options}{outstyle}; | ||
| 736 | 1 | 33µs | 3 | 17µs | $outstyle = "summary" unless $outstyle =~ qr/^(summary|yaml|json)$/; # spent 8µs making 1 call to Benchmark::Perl::Formance::CORE:qr
# spent 7µs making 1 call to Benchmark::Perl::Formance::CORE:match
# spent 3µs making 1 call to Benchmark::Perl::Formance::CORE:regcomp |
| 737 | 1 | 2µs | my $sub = "print_outstyle_$outstyle"; | ||
| 738 | |||||
| 739 | 1 | 11µs | 1 | 10.2ms | $self->$sub($RESULTS); # spent 10.2ms making 1 call to Benchmark::Perl::Formance::print_outstyle_summary |
| 740 | } | ||||
| 741 | |||||
| 742 | 1 | 16µs | 1; | ||
| 743 | |||||
| 744 | __END__ | ||||
sub Benchmark::Perl::Formance::CORE:close; # opcode | |||||
sub Benchmark::Perl::Formance::CORE:match; # opcode | |||||
# spent 365µs within Benchmark::Perl::Formance::CORE:open which was called:
# once (365µs+0s) by Benchmark::Perl::Formance::run_plugin at line 268 | |||||
# spent 51µs within Benchmark::Perl::Formance::CORE:print which was called 2 times, avg 26µs/call:
# 2 times (51µs+0s) by Benchmark::Perl::Formance::print_outstyle_summary at line 726, avg 26µs/call | |||||
sub Benchmark::Perl::Formance::CORE:qr; # opcode | |||||
sub Benchmark::Perl::Formance::CORE:regcomp; # opcode | |||||
sub Benchmark::Perl::Formance::CORE:sort; # opcode | |||||
# spent 1µs within Benchmark::Perl::Formance::CORE:subst which was called:
# once (1µs+0s) by Benchmark::Perl::Formance::run_plugin at line 260 |