line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tapper::TestSuite::Benchmark::Perl::Formance; |
2
|
|
|
|
|
|
|
# git description: v4.1.0-2-gd444784 |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
1
|
|
|
1
|
|
83183
|
$Tapper::TestSuite::Benchmark::Perl::Formance::AUTHORITY = 'cpan:TAPPER'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
{ |
8
|
|
|
|
|
|
|
$Tapper::TestSuite::Benchmark::Perl::Formance::VERSION = '4.1.1'; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
# ABSTRACT: Tapper - Wrapper for Benchmark::Perl::Formance |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
12
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
13
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
4470
|
use IO::Socket::INET; |
|
1
|
|
|
|
|
110455
|
|
|
1
|
|
|
|
|
13
|
|
16
|
1
|
|
|
1
|
|
8070
|
use Benchmark::Perl::Formance; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Getopt::Long ":config", "no_ignore_case", "bundling"; |
18
|
|
|
|
|
|
|
use Config; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _uname { |
21
|
|
|
|
|
|
|
my $uname = `uname -a`; |
22
|
|
|
|
|
|
|
chomp $uname; |
23
|
|
|
|
|
|
|
return $uname; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _hostname { |
27
|
|
|
|
|
|
|
my $hostname = `hostname`; |
28
|
|
|
|
|
|
|
chomp $hostname; |
29
|
|
|
|
|
|
|
$hostname = "perl64.org" if $hostname eq "h1891504"; # special case for PerlFormance.Net Æsthetics |
30
|
|
|
|
|
|
|
return $hostname; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _osname { |
34
|
|
|
|
|
|
|
my $osname = `cat /etc/issue.net | head -1`; |
35
|
|
|
|
|
|
|
chomp $osname; |
36
|
|
|
|
|
|
|
return $osname; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _cpuinfo { |
40
|
|
|
|
|
|
|
my @cpus = map { chomp; s/^\s*//; $_ } `grep 'model name' < /proc/cpuinfo | cut -d: -f2-`; |
41
|
|
|
|
|
|
|
my %cpu_count = (); |
42
|
|
|
|
|
|
|
$cpu_count{$_}++ foreach @cpus; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $cpuinfo = join(', ', map { $cpu_count{$_}." cores [$_]" } keys %cpu_count); |
45
|
|
|
|
|
|
|
return $cpuinfo; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _ram { |
49
|
|
|
|
|
|
|
my $ram = `free -m | grep -i mem: | awk '{print \$2}'`; |
50
|
|
|
|
|
|
|
chomp $ram; |
51
|
|
|
|
|
|
|
$ram .= 'MB'; |
52
|
|
|
|
|
|
|
return $ram; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _starttime_test_program { |
56
|
|
|
|
|
|
|
my $starttime_test_program = `date --rfc-2822` ; |
57
|
|
|
|
|
|
|
chomp $starttime_test_program; |
58
|
|
|
|
|
|
|
return $starttime_test_program; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _perl_gitversion { |
62
|
|
|
|
|
|
|
my $perlpath = "$^X"; |
63
|
|
|
|
|
|
|
$perlpath =~ s,/[^/]*$,,; |
64
|
|
|
|
|
|
|
my $perl_gitversion = "$perlpath/perl-gitversion"; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
if (-x $perl_gitversion) { |
67
|
|
|
|
|
|
|
my $gitversion = qx!$perl_gitversion! ; |
68
|
|
|
|
|
|
|
chomp $gitversion; |
69
|
|
|
|
|
|
|
return $gitversion; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _suite_name { |
74
|
|
|
|
|
|
|
sprintf("benchmark-perlformance-%d.%d%s", |
75
|
|
|
|
|
|
|
$Config{PERL_REVISION}, |
76
|
|
|
|
|
|
|
$Config{PERL_VERSION}, |
77
|
|
|
|
|
|
|
($ENV{PERLFORMANCE_TESTMODE_FAST} ? "-fast" : ""), |
78
|
|
|
|
|
|
|
); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
sub _suite_version { $Tapper::TestSuite::Benchmark::Perl::Formance::VERSION } |
81
|
|
|
|
|
|
|
sub _suite_type { 'benchmark' } |
82
|
|
|
|
|
|
|
sub _reportgroup_arbitrary { $ENV{TAPPER_REPORT_GROUP} } |
83
|
|
|
|
|
|
|
sub _reportgroup_testrun { $ENV{TAPPER_TESTRUN} } |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub tapper_section_meta |
86
|
|
|
|
|
|
|
{ |
87
|
|
|
|
|
|
|
my $uname = _uname(); |
88
|
|
|
|
|
|
|
my $osname = _osname(); |
89
|
|
|
|
|
|
|
my $cpuinfo = _cpuinfo(); |
90
|
|
|
|
|
|
|
my $ram = _ram(); |
91
|
|
|
|
|
|
|
my $starttime_test_program = _starttime_test_program(); |
92
|
|
|
|
|
|
|
my $gitversion = _perl_gitversion(); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $output = ""; |
95
|
|
|
|
|
|
|
$output .= "# Tapper-uname: $uname\n"; |
96
|
|
|
|
|
|
|
$output .= "# Tapper-osname: $osname\n"; |
97
|
|
|
|
|
|
|
$output .= "# Tapper-cpuinfo: $cpuinfo\n"; |
98
|
|
|
|
|
|
|
$output .= "# Tapper-ram: $ram\n"; |
99
|
|
|
|
|
|
|
$output .= "# Tapper-language-description: Perl-$]\n"; |
100
|
|
|
|
|
|
|
$output .= "# Tapper-changeset: $gitversion\n" if $gitversion; |
101
|
|
|
|
|
|
|
$output .= "# Tapper-starttime-test-program: $starttime_test_program\n"; |
102
|
|
|
|
|
|
|
#$output .= "# Tapper-ticket-url: http://speed.perlformance.net/changes/?rev=$gitversion\n" if $gitversion; |
103
|
|
|
|
|
|
|
$output .= "# Tapper-moreinfo-url: http://speed.perlformance.net/changes/?rev=$gitversion\n" if $gitversion; |
104
|
|
|
|
|
|
|
return $output; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub tapper_suite_meta |
108
|
|
|
|
|
|
|
{ |
109
|
|
|
|
|
|
|
my $suite_name = _suite_name(); |
110
|
|
|
|
|
|
|
my $suite_version = _suite_version(); |
111
|
|
|
|
|
|
|
my $suite_type = _suite_type(); |
112
|
|
|
|
|
|
|
my $hostname = _hostname(); |
113
|
|
|
|
|
|
|
my $reportgroup_arbitrary = _reportgroup_arbitrary(); |
114
|
|
|
|
|
|
|
my $reportgroup_testrun = _reportgroup_testrun(); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# to be used by Tapper::* modules |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my $output = "ok tapper-suite-meta\n"; |
119
|
|
|
|
|
|
|
$output .= "# Tapper-reportgroup-arbitrary: $reportgroup_arbitrary\n" if $reportgroup_arbitrary; |
120
|
|
|
|
|
|
|
$output .= "# Tapper-reportgroup-testrun: $reportgroup_testrun\n" if $reportgroup_testrun; |
121
|
|
|
|
|
|
|
$output .= "# Tapper-suite-name: $suite_name\n"; |
122
|
|
|
|
|
|
|
$output .= "# Tapper-suite-version: $suite_version\n"; |
123
|
|
|
|
|
|
|
$output .= "# Tapper-suite-type: $suite_type\n"; |
124
|
|
|
|
|
|
|
$output .= "# Tapper-machine-name: $hostname\n"; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
return $output; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub usage |
130
|
|
|
|
|
|
|
{ |
131
|
|
|
|
|
|
|
print 'tapper-testsuite-perlformance - Tapper - Wrapper for Benchmark:Perl::Formance |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Usage: |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
$ tapper-testsuite-perlformance -v |
136
|
|
|
|
|
|
|
$ tapper-testsuite-perlformance --perlpath="/opt/bin/perl5.8.9" |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Options: |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
-h | --help ... print this help screen |
141
|
|
|
|
|
|
|
-v | --verbose ... some verbose messages to stdout |
142
|
|
|
|
|
|
|
--perlpath ... complete call path of "perl" executable |
143
|
|
|
|
|
|
|
--perlformancepath ... complete call path of "benchmark-perlformance" script |
144
|
|
|
|
|
|
|
--plugins=Foo,Bar ... plugin list, passed through to benchmark-perlformance |
145
|
|
|
|
|
|
|
'; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub get_options |
149
|
|
|
|
|
|
|
{ |
150
|
|
|
|
|
|
|
my $help = 0; |
151
|
|
|
|
|
|
|
my $verbose = 0; |
152
|
|
|
|
|
|
|
my $plugins = ""; |
153
|
|
|
|
|
|
|
my $perlpath = "$^X"; |
154
|
|
|
|
|
|
|
my $perlformancepath = ""; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
my $ok = GetOptions ( |
157
|
|
|
|
|
|
|
"help|h" => \$help, |
158
|
|
|
|
|
|
|
"verbose|v+" => \$verbose, |
159
|
|
|
|
|
|
|
"plugins=s" => \$plugins, |
160
|
|
|
|
|
|
|
"perlpath=s" => \$perlpath, |
161
|
|
|
|
|
|
|
"perlformancepath=s" => \$perlformancepath, |
162
|
|
|
|
|
|
|
); |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
do { usage; exit 0 } if $help; |
165
|
|
|
|
|
|
|
do { usage; exit -1 } if not $ok; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
if (not $perlformancepath) { |
168
|
|
|
|
|
|
|
$perlformancepath = $perlpath; |
169
|
|
|
|
|
|
|
$perlformancepath =~ s!^(.*)/[^/]+$!$1/benchmark-perlformance!; |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
if ($plugins) { |
173
|
|
|
|
|
|
|
$plugins = "--plugins=$plugins"; |
174
|
|
|
|
|
|
|
} elsif ($ENV{HARNESS_ACTIVE}) { |
175
|
|
|
|
|
|
|
$plugins = "--plugins=Shootout,DPath"; |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
return { |
179
|
|
|
|
|
|
|
help => $help, |
180
|
|
|
|
|
|
|
verbose => $verbose, |
181
|
|
|
|
|
|
|
perlpath => $perlpath, |
182
|
|
|
|
|
|
|
plugins => $plugins, |
183
|
|
|
|
|
|
|
perlformancepath => $perlformancepath, |
184
|
|
|
|
|
|
|
}; |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub send_report { |
188
|
|
|
|
|
|
|
my ($report) = @_; |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
my %cfg; |
191
|
|
|
|
|
|
|
$cfg{report_server} = $ENV{TAPPER_REPORT_SERVER} || 'perlformance.net'; |
192
|
|
|
|
|
|
|
$cfg{report_api_port} = $ENV{TAPPER_REPORT_API_PORT} || 7358; |
193
|
|
|
|
|
|
|
$cfg{report_port} = $ENV{TAPPER_REPORT_PORT} || 7357; |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
# following options are not yet used in this class |
196
|
|
|
|
|
|
|
$cfg{mcp_server} = $ENV{TAPPER_SERVER}; |
197
|
|
|
|
|
|
|
$cfg{runtime} = $ENV{TAPPER_TS_RUNTIME}; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
my $sock = IO::Socket::INET->new(PeerAddr => $cfg{report_server}, |
200
|
|
|
|
|
|
|
PeerPort => $cfg{report_port}, |
201
|
|
|
|
|
|
|
Proto => 'tcp'); |
202
|
|
|
|
|
|
|
if ($sock) { |
203
|
|
|
|
|
|
|
$sock->print($report); |
204
|
|
|
|
|
|
|
$sock->close; |
205
|
|
|
|
|
|
|
} else { |
206
|
|
|
|
|
|
|
warn "# Can't open connection to ", $cfg{report_server}, " ($!)"; |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
return 0; |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub PerlFormanceResults |
212
|
|
|
|
|
|
|
{ |
213
|
|
|
|
|
|
|
my ($options) = @_; |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
my $perlformancepath = $options->{perlformancepath}; |
216
|
|
|
|
|
|
|
my ($plugins, $verbose) = @$options{qw(plugins verbose)}; |
217
|
|
|
|
|
|
|
my $fastmode = ($ENV{PERLFORMANCE_TESTMODE_FAST} ? "--fastmode" : ""); |
218
|
|
|
|
|
|
|
my $cmd = "$^X $perlformancepath --tapdescription='benchmarks' $fastmode -ccc -v -p --outstyle=yaml --indent=2 $plugins --codespeed 2>&1"; |
219
|
|
|
|
|
|
|
print STDERR "# $cmd\n" if $verbose >= 2; |
220
|
|
|
|
|
|
|
my $yaml = qx!$cmd!; |
221
|
|
|
|
|
|
|
return $yaml; |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
sub main { |
225
|
|
|
|
|
|
|
my $options = get_options; |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
my $output = "TAP Version 13\n"; |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
$output .= "1..1\n"; |
230
|
|
|
|
|
|
|
$output .= "# Tapper-Section: metainfo\n"; |
231
|
|
|
|
|
|
|
$output .= tapper_suite_meta || ""; |
232
|
|
|
|
|
|
|
$output .= tapper_section_meta || ""; |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
$output .= "1..1\n"; |
235
|
|
|
|
|
|
|
$output .= "# Tapper-Section: results\n"; |
236
|
|
|
|
|
|
|
$output .= PerlFormanceResults($options); |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
return $output; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub run |
242
|
|
|
|
|
|
|
{ |
243
|
|
|
|
|
|
|
my $output = main; |
244
|
|
|
|
|
|
|
print $output; |
245
|
|
|
|
|
|
|
send_report($output) unless $ENV{HARNESS_ACTIVE}; |
246
|
|
|
|
|
|
|
} |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
1; # End of Tapper::TestSuite::Benchmark::Perl::Formance |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=pod |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=encoding utf-8 |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head1 NAME |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Tapper::TestSuite::Benchmark::Perl::Formance - Tapper - Wrapper for Benchmark::Perl::Formance |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=head1 SYNOPSIS |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
You most likely want to run the frontend cmdline tool like this |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
$ tapper-testsuite-benchmark-perl-formance -vvv |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=head1 DESCRIPTION |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
This is a Tapper wrapper for L. |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head1 FUNCTIONS |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=head2 PerlFormanceResults |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=head2 tapper_section_meta |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=head2 tapper_suite_meta |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head2 send_report |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=head2 get_options |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=head2 main |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=head2 run |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head2 usage |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=head1 AUTHOR |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
AMD OSRC Tapper Team |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
This software is Copyright (c) 2012 by Advanced Micro Devices, Inc.. |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
This is free software, licensed under: |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=cut |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
__END__ |