Filename | /home/ss5/local/projects/Benchmark-Perl-Formance/bin/benchmark-perlformance |
Statements | Executed 5 statements in 518µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 9.68ms | 120ms | BEGIN@5 | main::
73 | 5 | 5 | 117µs | 117µs | isa (xsub) | UNIVERSAL::
8 | 8 | 5 | 72µs | 72µs | VERSION (xsub) | UNIVERSAL::
52 | 1 | 1 | 38µs | 38µs | SvREADONLY (xsub) | Internals::
33 | 1 | 1 | 35µs | 35µs | method_changed_in (xsub) | mro::
1 | 1 | 1 | 6µs | 6µs | (bool (xsub) | version::
1 | 1 | 1 | 4µs | 4µs | (cmp (xsub) | version::
0 | 0 | 0 | 0s | 0s | RUNTIME | main::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
0 | 1 | 2µs | Profile data that couldn't be associated with a specific line: # spent 2µs making 1 call to Class::XSAccessor::END | ||
1 | #! /usr/bin/perl | ||||
2 | # PODNAME: benchmark-perlformance | ||||
3 | # ABSTRACT: Frontend for Benchmark::Perl::Formance | ||||
4 | |||||
5 | 2 | 486µs | 1 | 120ms | # spent 120ms (9.68+110) within main::BEGIN@5 which was called:
# once (9.68ms+110ms) by main::RUNTIME at line 5 # spent 120ms making 1 call to main::BEGIN@5 |
6 | |||||
7 | 1 | 4µs | 1 | 10µs | my $pf = Benchmark::Perl::Formance->new; # spent 10µs making 1 call to Benchmark::Perl::Formance::new |
8 | |||||
9 | 1 | 3µs | 1 | 5.55s | my $results = $pf->run; # spent 5.55s making 1 call to Benchmark::Perl::Formance::run |
10 | 1 | 25µs | 1 | 10.2ms | $pf->print_results($results); # spent 10.2ms making 1 call to Benchmark::Perl::Formance::print_results |
11 | |||||
12 | =pod | ||||
13 | |||||
14 | =head1 ABOUT | ||||
15 | |||||
16 | This is the frontend commandline tool for starting the performance | ||||
17 | benchmark runs. | ||||
18 | |||||
19 | After running it prints out the results which you can take to compare | ||||
20 | them to runs with other Perl versions, other architectures, different | ||||
21 | compile time configuration or on different machines. | ||||
22 | |||||
23 | =head1 SYNOPSIS | ||||
24 | |||||
25 | Usage: | ||||
26 | |||||
27 | $ benchmark-perlformance | ||||
28 | $ benchmark-perlformance --plugins=SpamAssassin,Fib,Rx | ||||
29 | $ benchmark-perlformance --plugins=SpamAssassin,Fib,Rx -q | ||||
30 | $ benchmark-perlformance --plugins=SpamAssassin,Fib,Rx -v | ||||
31 | $ benchmark-perlformance --plugins=SpamAssassin,Fib,Rx -vv -ccccc | ||||
32 | |||||
33 | If run directly it uses the perl in your PATH: | ||||
34 | |||||
35 | $ /path/to/benchmark-perlformance | ||||
36 | |||||
37 | |||||
38 | To use another Perl start it via | ||||
39 | |||||
40 | $ /other/path/to/bin/perl /path/to/benchmark-perlformance | ||||
41 | |||||
42 | To provide configuration, general and plugin specific, you can use the | ||||
43 | C<-D> option to define key/value pairs: | ||||
44 | |||||
45 | $ benchmark-perlformance -DShootout_fasta_n=5500 [...] | ||||
46 | |||||
47 | Plugins usually follow the convention that the options are prefixed | ||||
48 | with the plugin name, like in the example it means the config value | ||||
49 | C<n> used by the plugin C<Shootout::fasta>. | ||||
50 | |||||
51 | =head1 OPTIONS | ||||
52 | |||||
53 | There are some options available. | ||||
54 | |||||
55 | =over 4 | ||||
56 | |||||
57 | =item --help | ||||
58 | |||||
59 | =item -h | ||||
60 | |||||
61 | prints out a help page. | ||||
62 | |||||
63 | =item --plugins=SpamAssassin,Fib,Rx | ||||
64 | |||||
65 | Use only a particular list of sub benchmarks. The comma-separated list | ||||
66 | refers to C<Benchmark::Perl::Formance::Plugin::*> respectively. | ||||
67 | |||||
68 | If you provide C<--plugins=ALL> then all known plugins will be tried. | ||||
69 | |||||
70 | If you do not provide the C<--plugins> option then a default list of | ||||
71 | "mostly harmless" plugins is used which should work with the same | ||||
72 | dependencies of Benchmark::Perl::Formance itself (currently: C<DPath>, | ||||
73 | C<Fib>, C<FibOO>, C<Mem>, C<Prime>, C<Rx>, C<Shootout::>{C<fasta>, | ||||
74 | C<regexdna>, C<binarytrees>, C<revcomp>, C<nbody>, C<spectralnorm>}). | ||||
75 | |||||
76 | =item --outstyle=summary | ||||
77 | |||||
78 | This enables a condensed tabular output instead of YAML. | ||||
79 | Default since v0.10. | ||||
80 | |||||
81 | =item --outstyle=yaml | ||||
82 | |||||
83 | This activates YAML formatted output. | ||||
84 | |||||
85 | =item --fastmode | ||||
86 | |||||
87 | If this is set then some plugins try to scale down the stress to take | ||||
88 | less time (with less useful results, of course). Mostly for easier | ||||
89 | development. | ||||
90 | |||||
91 | =item --stabilize-cpu | ||||
92 | |||||
93 | Runs an external utility script | ||||
94 | (C<benchmark-perlformance-set-stable-system>) which stabilizes the | ||||
95 | system to get less deviation on multiple runs. | ||||
96 | |||||
97 | The system is stabilized using: | ||||
98 | |||||
99 | =over 4 | ||||
100 | |||||
101 | =item * Disable address space randomization (ASLR) | ||||
102 | |||||
103 | See L<https://wiki.ubuntu.com/Security/Features> | ||||
104 | |||||
105 | =item * Set maximum frequency of all cpus to minimum frequency | ||||
106 | |||||
107 | Therefore the system can't scale down further unexpectedly, e.g. when | ||||
108 | it gets hot. | ||||
109 | |||||
110 | =item * Drop caches | ||||
111 | |||||
112 | See L<http://linux-mm.org/Drop_Caches>. | ||||
113 | |||||
114 | =item * Classical disk sync | ||||
115 | |||||
116 | Flush file system buffers, see C<man 1 sync>. | ||||
117 | |||||
118 | =back | ||||
119 | |||||
120 | The external utility script is called via C<sudo> - please configure | ||||
121 | your sudo in advance to suit your needs, e.g. to not ask for | ||||
122 | password. An alternative approach is to run | ||||
123 | C<benchmark-perlformance-set-stable-system lo> once when your system | ||||
124 | boots, like from C</etc/init.d/> (and run your cpu slow all the time, | ||||
125 | obviously). | ||||
126 | |||||
127 | B<Be careful>: maybe the cpu is not restored perfectly after a run, | ||||
128 | e.g., due to crashes during the benchmarking, or the values are not | ||||
129 | the very same. This could make your next results without | ||||
130 | C<--stabilize-cpu> inconclusive. Reboot your system to ensure a clean | ||||
131 | state or use C<--stabilize-cpu> all the time. | ||||
132 | |||||
133 | =item --version | ||||
134 | |||||
135 | Print Benchmark::Perl::Formance version. | ||||
136 | In conjunction with C<-v> it prints out all available | ||||
137 | plugins with version. | ||||
138 | |||||
139 | =item --verbose | ||||
140 | |||||
141 | =item -v | ||||
142 | |||||
143 | =item -vv | ||||
144 | |||||
145 | =item -vvv | ||||
146 | |||||
147 | =item -vvvv | ||||
148 | |||||
149 | =item -vvvvv | ||||
150 | |||||
151 | Increases the verbosity level during the run of the | ||||
152 | benchmarks. Default is only print the result (and maybe some output | ||||
153 | from external tools). | ||||
154 | |||||
155 | To increase the number of keys from your Perl Config that are included | ||||
156 | in the result use one or more -c options. | ||||
157 | |||||
158 | Please note that only one single -v is not enough to see errors that | ||||
159 | occur when trying to load a plugin. They are only marked as | ||||
160 | "skipped". Use -vv to see the error message; -vvv for progress | ||||
161 | information; -vvvv or more should be used for debugging info. | ||||
162 | |||||
163 | =item -q | ||||
164 | |||||
165 | Be quiet; do not output results. | ||||
166 | |||||
167 | =item --showconfig | ||||
168 | |||||
169 | =item -c | ||||
170 | |||||
171 | Gives you the most basic information like Perl version, operating | ||||
172 | system name and architecture, i.e., C<perlpath>, C<version>, | ||||
173 | C<archname>, C<archname64>, C<osvers>. | ||||
174 | |||||
175 | =item -cc | ||||
176 | |||||
177 | Adds C<gccversion>, C<gnulibc_version>, C<usemymalloc>, | ||||
178 | C<config_args>, C<optimize>. | ||||
179 | |||||
180 | =item -ccc | ||||
181 | |||||
182 | Adds C<ccflags>, C<ccname>, C<cccdlflags>, C<ccdlflags>, C<cppflags>, C<nm_so_opt>. | ||||
183 | |||||
184 | =item -cccc | ||||
185 | |||||
186 | Adds about 40 more keys from Perl's %Config hash - everything that | ||||
187 | sounds like it could either influence performance between different | ||||
188 | hardware, configurations, and compilers, or interesting meta | ||||
189 | information around that. | ||||
190 | |||||
191 | =item -ccccc | ||||
192 | |||||
193 | Includes all info from Perl's %Config hash. | ||||
194 | |||||
195 | =item -p | ||||
196 | |||||
197 | Includes platform info via Devel::Platform::Info | ||||
198 | |||||
199 | (Users who want to greet the 80s combine it this way: C<-cccp>. :-) | ||||
200 | |||||
201 | =item --tapdescription="some description" | ||||
202 | |||||
203 | When given this will prepend the YAML with a TAP line | ||||
204 | |||||
205 | ok some description | ||||
206 | |||||
207 | This makes it easier for wrappers to embed the output into TAP which | ||||
208 | otherwise need to differentiate between output (verbose and other) and | ||||
209 | the YAML. | ||||
210 | |||||
211 | =item --indent=2 | ||||
212 | |||||
213 | This indents the whole yaml output by some spaces (2 in the | ||||
214 | example). Together with C<--tapdescription> it makes an TAP v13 style | ||||
215 | structured diagnostics block which can, for instance, be evaluated | ||||
216 | using L<TAP::DOM>. | ||||
217 | |||||
218 | =item --useforks | ||||
219 | |||||
220 | By setting this you can activate the C<forks> drop-in replacement for | ||||
221 | threads. | ||||
222 | |||||
223 | See | ||||
224 | L<Benchmark::Perl::Formance::Plugin::Threads|Benchmark::Perl::Formance::Plugin::Threads>. | ||||
225 | |||||
226 | =item -Dkey=value | ||||
227 | |||||
228 | With this you can configure some plugins by defining key/value pairs. | ||||
229 | |||||
230 | =back | ||||
231 | |||||
232 | =head1 ENVIRONMENT VARIABLES | ||||
233 | |||||
234 | There are some options available. | ||||
235 | |||||
236 | =over 4 | ||||
237 | |||||
238 | =item PERLFORMANCE_SALEARN | ||||
239 | |||||
240 | See L<Benchmark::Perl::Formance::Plugin::SpamAssassin|Benchmark::Perl::Formance::Plugin::SpamAssassin>. Contains | ||||
241 | the path to the "sa-learn" executable. | ||||
242 | |||||
243 | =item PERLFORMANCE_THREADCOUNT | ||||
244 | |||||
245 | See | ||||
246 | L<Benchmark::Perl::Formance::Plugin::Threads|Benchmark::Perl::Formance::Plugin::Threads>. Use | ||||
247 | this many count of threads. Default is 16. | ||||
248 | |||||
249 | =back | ||||
250 | |||||
251 | =head1 PLUGINS | ||||
252 | |||||
253 | Please read the documentation for the used plugins, as they might accept | ||||
254 | special configuration, usually via C<-Dkey=value> options. | ||||
255 | |||||
256 | =over 4 | ||||
257 | |||||
258 | =item L<Benchmark::Perl::Formance::Plugin::SpamAssassin|Benchmark::Perl::Formance::Plugin::SpamAssassin> | ||||
259 | |||||
260 | Run Bayes learning tools from SpamAssassin. | ||||
261 | |||||
262 | =item L<Benchmark::Perl::Formance::Plugin::Rx|Benchmark::Perl::Formance::Plugin::Rx> | ||||
263 | |||||
264 | Stress using Perl6/Perl5 tools around STD.pm | ||||
265 | |||||
266 | =item L<Benchmark::Perl::Formance::Plugin::DPath|Benchmark::Perl::Formance::Plugin::DPath> | ||||
267 | |||||
268 | Use DPath to stress lookup, traversing and copying data structures. | ||||
269 | |||||
270 | =item L<Benchmark::Perl::Formance::Plugin::Rx|Benchmark::Perl::Formance::Plugin::Rx> | ||||
271 | |||||
272 | Regular expressions, basic functions and pathological regex stressing. | ||||
273 | |||||
274 | =item L<Benchmark::Perl::Formance::Plugin::RxCmp|Benchmark::Perl::Formance::Plugin::RxCmp> | ||||
275 | |||||
276 | Compare differnet regex engines (pluggable since Perl 5.10). | ||||
277 | |||||
278 | =item L<Benchmark::Perl::Formance::Plugin::Fib|Benchmark::Perl::Formance::Plugin::Fib> | ||||
279 | |||||
280 | Fibonnacci numbers to stress recursion and function calls. | ||||
281 | |||||
282 | =item L<Benchmark::Perl::Formance::Plugin::FibOO|Benchmark::Perl::Formance::Plugin::FibOO> | ||||
283 | |||||
284 | Fibonnacci numbers to stress recursion and method calls, with plain Perl OO. | ||||
285 | |||||
286 | =item L<Benchmark::Perl::Formance::Plugin::FibMoose|Benchmark::Perl::Formance::Plugin::FibMoose> | ||||
287 | |||||
288 | Fibonnacci numbers to stress recursion and method calls, with Moose. | ||||
289 | |||||
290 | =item L<Benchmark::Perl::Formance::Plugin::FibMouse|Benchmark::Perl::Formance::Plugin::FibMouse> | ||||
291 | |||||
292 | Fibonnacci numbers to stress recursion and method calls, with Mouse. | ||||
293 | |||||
294 | =item L<Benchmark::Perl::Formance::Plugin::FibMXDeclare|Benchmark::Perl::Formance::Plugin::FibMXDeclare> | ||||
295 | |||||
296 | Fibonnacci numbers to stress recursion and method calls, with MooseX::Declare. | ||||
297 | |||||
298 | =item L<Benchmark::Perl::Formance::Plugin::Threads|Benchmark::Perl::Formance::Plugin::Threads> | ||||
299 | |||||
300 | Thread handling. | ||||
301 | |||||
302 | =item L<Benchmark::Perl::Formance::Plugin::Shootout|Benchmark::Perl::Formance::Plugin::Shootout> | ||||
303 | |||||
304 | Runs some Perl benchmarks from the Language Shootout on | ||||
305 | alioth.debian.org. | ||||
306 | |||||
307 | =item L<Benchmark::Perl::Formance::Plugin::P6STD|Benchmark::Perl::Formance::Plugin::P6STD> | ||||
308 | |||||
309 | Runs tools from Perl6 STD world. | ||||
310 | |||||
311 | =back | ||||
312 | |||||
313 | =cut | ||||
314 | |||||
# spent 38µs within Internals::SvREADONLY which was called 52 times, avg 733ns/call:
# 52 times (38µs+0s) by constant::import at line 147 of constant.pm, avg 733ns/call | |||||
# spent 72µs within UNIVERSAL::VERSION which was called 8 times, avg 9µs/call:
# once (11µs+0s) by Data::DPath::Path::BEGIN@17 at line 17 of Data/DPath/Path.pm
# once (10µs+0s) by Data::OptList::BEGIN@11 at line 11 of Data/OptList.pm
# once (10µs+0s) by Exporter::Heavy::heavy_export at line 120 of Exporter/Heavy.pm
# once (9µs+0s) by Exception::Class::Base::BEGIN@9 at line 9 of Exception/Class/Base.pm
# once (9µs+0s) by Exception::Class::Base::BEGIN@10 at line 10 of Exception/Class/Base.pm
# once (9µs+0s) by Sub::Exporter::BEGIN@11 at line 11 of Sub/Exporter.pm
# once (6µs+0s) by Sub::Exporter::BEGIN@12 at line 12 of Sub/Exporter.pm
# once (6µs+0s) by Sub::Exporter::BEGIN@13 at line 13 of Sub/Exporter.pm | |||||
# spent 117µs within UNIVERSAL::isa which was called 73 times, avg 2µs/call:
# 46 times (81µs+0s) by Devel::StackTrace::_ref_to_string at line 79 of Devel/StackTrace.pm, avg 2µs/call
# 12 times (17µs+0s) by base::import at line 74 of base.pm, avg 1µs/call
# 8 times (9µs+0s) by Exception::Class::Base::caught at line 209 of Exception/Class/Base.pm, avg 1µs/call
# 4 times (6µs+0s) by Iterator::Util::imap at line 43 of Iterator/Util.pm, avg 2µs/call
# 3 times (4µs+0s) by Exception::Class::_make_subclass at line 152 of Exception/Class.pm, avg 1µs/call | |||||
# spent 35µs within mro::method_changed_in which was called 33 times, avg 1µs/call:
# 33 times (35µs+0s) by constant::import at line 162 of constant.pm, avg 1µs/call | |||||
# spent 6µs within version::(bool which was called:
# once (6µs+0s) by Benchmark::Perl::Formance::BEGIN@8 at line 57 of Config.pm | |||||
# spent 4µs within version::(cmp which was called:
# once (4µs+0s) by Benchmark::Perl::Formance::BEGIN@8 at line 60 of Config.pm |