| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::BenchmarkResults; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.005_62; |
|
4
|
1
|
|
|
1
|
|
655
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
864
|
use Statistics::Lite qw(:all); |
|
|
1
|
|
|
|
|
1452
|
|
|
|
1
|
|
|
|
|
921
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Exporter; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
|
14
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
|
15
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# This allows declaration use Data::BenchmarkResults ':all'; |
|
18
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
|
19
|
|
|
|
|
|
|
# will save memory. |
|
20
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
) ] ); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our @EXPORT = qw( |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Preloaded methods go here. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub new |
|
35
|
|
|
|
|
|
|
{ |
|
36
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
37
|
0
|
|
|
|
|
|
my $self = {}; |
|
38
|
0
|
|
|
|
|
|
bless($self,$class); |
|
39
|
0
|
|
|
|
|
|
return $self; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub add_result_set |
|
43
|
|
|
|
|
|
|
{ |
|
44
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
45
|
0
|
|
|
|
|
|
my $test_name = shift; |
|
46
|
0
|
|
|
|
|
|
my $file_name = shift; |
|
47
|
0
|
|
|
|
|
|
my $result_set = shift; |
|
48
|
0
|
|
|
|
|
|
push (@{$self->{test_results}{$test_name}{$file_name}},$result_set); |
|
|
0
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub add_computed_set |
|
52
|
|
|
|
|
|
|
{ |
|
53
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
54
|
0
|
|
|
|
|
|
my $test_name = shift; |
|
55
|
0
|
|
|
|
|
|
my $result_set = shift; |
|
56
|
0
|
|
|
|
|
|
push (@{$self->{computed_results}{$test_name}},@$result_set); |
|
|
0
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub process_result_set |
|
62
|
|
|
|
|
|
|
{ |
|
63
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
64
|
0
|
|
|
|
|
|
my $test_name = shift; |
|
65
|
0
|
|
|
|
|
|
my $process = shift; |
|
66
|
0
|
|
|
|
|
|
my $tossextremes = shift; |
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my @computed = (); |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my @runs = values %{$self->{test_results}{$test_name}}; |
|
|
0
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
for my $row (0 .. $#{$runs[0]}) |
|
|
0
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
{ |
|
76
|
0
|
|
|
|
|
|
for my $column (0 .. $#{$runs[0][$row]}) |
|
|
0
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
{ # iterate through the columns of each row |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my @rowvalues = (); |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
for my $run (0 .. $#runs) |
|
82
|
|
|
|
|
|
|
{ |
|
83
|
0
|
|
|
|
|
|
my $cleaned = $runs[$run][$row][$column]; |
|
84
|
0
|
|
|
|
|
|
$cleaned =~ s/^\s+//; |
|
85
|
0
|
|
|
|
|
|
$cleaned =~ s/\s+$//; |
|
86
|
0
|
|
|
|
|
|
push @rowvalues, $cleaned; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
0
|
0
|
|
|
|
|
if ($tossextremes == 1) |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
{ |
|
92
|
0
|
|
|
|
|
|
(my $max, my $maxlocation) = Max_with_Index(\@rowvalues); |
|
93
|
0
|
|
|
|
|
|
splice(@rowvalues,$maxlocation,1); |
|
94
|
0
|
|
|
|
|
|
(my $min, my $minlocation) = Min_with_Index(\@rowvalues); |
|
95
|
0
|
|
|
|
|
|
splice(@rowvalues,$minlocation,1); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
|
if ($rowvalues[0] =~ /^\d+$/) |
|
99
|
0
|
|
|
|
|
|
{ |
|
100
|
1
|
|
|
1
|
|
7
|
no strict 'refs'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
364
|
|
|
101
|
0
|
|
|
|
|
|
$computed[$row][$column] = &$process(@rowvalues); |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
else {$computed[$row][$column] = $rowvalues[0];} |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} |
|
107
|
0
|
|
|
|
|
|
$self->add_computed_set($test_name,\@computed); |
|
108
|
0
|
|
|
|
|
|
return @computed; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub process_all_result_sets |
|
113
|
|
|
|
|
|
|
{ |
|
114
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
115
|
0
|
|
|
|
|
|
my $process = shift; |
|
116
|
0
|
|
|
|
|
|
my $tossextremes = shift; |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
foreach my $test_name (keys %{$self->{test_results}}) |
|
|
0
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
{ |
|
121
|
0
|
|
|
|
|
|
my @computed = (); |
|
122
|
0
|
|
|
|
|
|
my @runs = values %{$self->{test_results}{$test_name}}; |
|
|
0
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
for my $row (0 .. $#{$runs[0]}) |
|
|
0
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
{ |
|
128
|
0
|
|
|
|
|
|
for my $column (0 .. $#{$runs[0][$row]}) |
|
|
0
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
{ # iterate through the columns of each row |
|
130
|
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
my @rowvalues = (); |
|
132
|
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
for my $run (0 .. $#runs) |
|
134
|
|
|
|
|
|
|
{ |
|
135
|
0
|
|
|
|
|
|
my $cleaned = $runs[$run][$row][$column]; |
|
136
|
0
|
|
|
|
|
|
$cleaned =~ s/^\s+//; |
|
137
|
0
|
|
|
|
|
|
$cleaned =~ s/\s+$//; |
|
138
|
0
|
|
|
|
|
|
push @rowvalues, $cleaned; |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
0
|
0
|
|
|
|
|
if ($rowvalues[0] =~ /^\d+$/) |
|
144
|
0
|
|
|
|
|
|
{ |
|
145
|
0
|
0
|
|
|
|
|
if ($tossextremes == 1) |
|
146
|
|
|
|
|
|
|
{ |
|
147
|
0
|
|
|
|
|
|
(my $max, my $maxlocation) = Max_with_Index(\@rowvalues); |
|
148
|
0
|
|
|
|
|
|
splice(@rowvalues,$maxlocation,1); |
|
149
|
0
|
|
|
|
|
|
(my $min, my $minlocation) = Min_with_Index(\@rowvalues); |
|
150
|
0
|
|
|
|
|
|
splice(@rowvalues,$minlocation,1); |
|
151
|
|
|
|
|
|
|
} |
|
152
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1011
|
|
|
153
|
0
|
|
|
|
|
|
$computed[$row][$column] = &$process(@rowvalues); |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
else {$computed[$row][$column] = $rowvalues[0];} |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
} |
|
159
|
0
|
|
|
|
|
|
$self->add_computed_set($test_name,\@computed); |
|
160
|
|
|
|
|
|
|
} |
|
161
|
0
|
|
|
|
|
|
return 1; |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub compare_result_set |
|
165
|
|
|
|
|
|
|
{ |
|
166
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
167
|
0
|
|
|
|
|
|
my $second_results = shift; |
|
168
|
0
|
|
|
|
|
|
my $test_name = shift; |
|
169
|
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
my @runs = (); |
|
171
|
0
|
|
|
|
|
|
my @computed = (); |
|
172
|
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
push (@runs,$self->{computed_results}{$test_name}); |
|
174
|
0
|
|
|
|
|
|
push (@runs,$second_results->{computed_results}{$test_name}); |
|
175
|
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
|
for my $row (0 .. $#{$runs[0]}) |
|
|
0
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
{ |
|
179
|
0
|
|
|
|
|
|
for my $column (0 .. $#{$runs[0][$row]}) |
|
|
0
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
{ # iterate through the columns of each row |
|
181
|
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
|
my @rowvalues = (); |
|
183
|
|
|
|
|
|
|
|
|
184
|
0
|
|
|
|
|
|
for my $run (0 .. $#runs) |
|
185
|
|
|
|
|
|
|
{ |
|
186
|
0
|
|
|
|
|
|
push @rowvalues, $runs[$run][$row][$column]; |
|
187
|
|
|
|
|
|
|
} |
|
188
|
0
|
0
|
0
|
|
|
|
if (($rowvalues[0] =~ /^\d+\.*\d*$/) && ($rowvalues[0] >0)){ $computed[$row][$column] = Percentage_difference($rowvalues[0],$rowvalues[1]);} |
|
|
0
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
else |
|
190
|
|
|
|
|
|
|
{ |
|
191
|
0
|
|
|
|
|
|
$computed[$row][$column] = $rowvalues[0]; |
|
192
|
|
|
|
|
|
|
} |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
} |
|
197
|
|
|
|
|
|
|
|
|
198
|
0
|
|
|
|
|
|
return \@computed; |
|
199
|
|
|
|
|
|
|
} |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub compare_all_result_sets |
|
202
|
|
|
|
|
|
|
{ |
|
203
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
204
|
0
|
|
|
|
|
|
my $second_results = shift; |
|
205
|
0
|
|
|
|
|
|
my $test_name = shift; |
|
206
|
|
|
|
|
|
|
|
|
207
|
0
|
|
|
|
|
|
my %compared_tests = (); |
|
208
|
|
|
|
|
|
|
|
|
209
|
0
|
|
|
|
|
|
foreach my $test_name (keys %{$self->{test_results}}) |
|
|
0
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
{ |
|
211
|
0
|
|
|
|
|
|
my @runs = (); |
|
212
|
0
|
|
|
|
|
|
my @computed = (); |
|
213
|
|
|
|
|
|
|
|
|
214
|
0
|
|
|
|
|
|
push (@runs,$self->{computed_results}{$test_name}); |
|
215
|
0
|
|
|
|
|
|
push (@runs,$second_results->{computed_results}{$test_name}); |
|
216
|
|
|
|
|
|
|
|
|
217
|
0
|
|
|
|
|
|
for my $row (0 .. $#{$runs[0]}) |
|
|
0
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
{ |
|
220
|
0
|
|
|
|
|
|
for my $column (0 .. $#{$runs[0][$row]}) |
|
|
0
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
{ # iterate through the columns of each row |
|
222
|
|
|
|
|
|
|
|
|
223
|
0
|
|
|
|
|
|
my @rowvalues = (); |
|
224
|
|
|
|
|
|
|
|
|
225
|
0
|
|
|
|
|
|
for my $run (0 .. $#runs) |
|
226
|
|
|
|
|
|
|
{ |
|
227
|
0
|
|
|
|
|
|
push @rowvalues, $runs[$run][$row][$column]; |
|
228
|
|
|
|
|
|
|
} |
|
229
|
0
|
0
|
0
|
|
|
|
if (($rowvalues[0] =~ /^\d+\.*\d*$/) && ($rowvalues[0] >0)){ $computed[$row][$column] = Percentage_difference($rowvalues[0],$rowvalues[1]);} |
|
|
0
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
else |
|
231
|
|
|
|
|
|
|
{ |
|
232
|
0
|
|
|
|
|
|
$computed[$row][$column] = $rowvalues[0]; |
|
233
|
|
|
|
|
|
|
} |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
} |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
} |
|
238
|
0
|
|
|
|
|
|
$compared_tests{$test_name} = \@computed; |
|
239
|
|
|
|
|
|
|
} |
|
240
|
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
|
return \%compared_tests; |
|
242
|
|
|
|
|
|
|
} |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub print_calculated_sets |
|
245
|
|
|
|
|
|
|
{ |
|
246
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
247
|
|
|
|
|
|
|
|
|
248
|
0
|
|
|
|
|
|
for my $key (keys %{$self->{computed_results}}) |
|
|
0
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
{ |
|
250
|
0
|
|
|
|
|
|
print "Test=$key\n"; |
|
251
|
0
|
|
|
|
|
|
for my $i (0 .. $#{$self->{computed_results}{$key}}) |
|
|
0
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
{ |
|
253
|
0
|
|
|
|
|
|
for my $j (0 .. $#{$self->{computed_results}{$key}->[$i]}) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
{print "$self->{computed_results}{$key}->[$i][$j]\t";} |
|
255
|
0
|
|
|
|
|
|
print "\n"; |
|
256
|
|
|
|
|
|
|
} |
|
257
|
|
|
|
|
|
|
} |
|
258
|
0
|
|
|
|
|
|
print "\n"; |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
sub Max_with_Index { |
|
262
|
|
|
|
|
|
|
# takes an array ref - returns the max |
|
263
|
|
|
|
|
|
|
|
|
264
|
0
|
|
|
0
|
0
|
|
my $list = shift; |
|
265
|
0
|
|
|
|
|
|
my $max = $list->[0]; |
|
266
|
0
|
|
|
|
|
|
my $ind = 0; # new |
|
267
|
0
|
|
|
|
|
|
my $i = 0; # new |
|
268
|
0
|
|
|
|
|
|
foreach (@$list) { |
|
269
|
0
|
0
|
|
|
|
|
if ($_ > $max) { |
|
270
|
0
|
|
|
|
|
|
$max = $_; |
|
271
|
0
|
|
|
|
|
|
$ind = $i; # new |
|
272
|
|
|
|
|
|
|
} |
|
273
|
0
|
|
|
|
|
|
$i++; # new |
|
274
|
|
|
|
|
|
|
} |
|
275
|
|
|
|
|
|
|
|
|
276
|
0
|
|
|
|
|
|
return($max, $ind); |
|
277
|
|
|
|
|
|
|
} |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
sub Min_with_Index { |
|
280
|
|
|
|
|
|
|
# takes an array ref - returns the min |
|
281
|
|
|
|
|
|
|
|
|
282
|
0
|
|
|
0
|
0
|
|
my $list = shift; |
|
283
|
0
|
|
|
|
|
|
my $min = $list->[0]; |
|
284
|
0
|
|
|
|
|
|
my $ind = 0; # new |
|
285
|
0
|
|
|
|
|
|
my $i = 0; # new |
|
286
|
0
|
|
|
|
|
|
foreach (@$list) { |
|
287
|
0
|
0
|
|
|
|
|
if ($_ < $min) { |
|
288
|
0
|
|
|
|
|
|
$min = $_; |
|
289
|
0
|
|
|
|
|
|
$ind = $i; # new |
|
290
|
|
|
|
|
|
|
} |
|
291
|
0
|
|
|
|
|
|
$i++; # new |
|
292
|
|
|
|
|
|
|
} |
|
293
|
|
|
|
|
|
|
|
|
294
|
0
|
|
|
|
|
|
return($min, $ind); |
|
295
|
|
|
|
|
|
|
} |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
sub Percentage_difference #Takes two values and returns the relative percentage difference of the second from the first |
|
298
|
|
|
|
|
|
|
{ |
|
299
|
0
|
|
|
0
|
0
|
|
my $first = shift; |
|
300
|
0
|
|
|
|
|
|
my $second = shift; |
|
301
|
|
|
|
|
|
|
|
|
302
|
0
|
|
|
|
|
|
my $absolute_change = $first-$second; |
|
303
|
0
|
|
|
|
|
|
my $relative_change = $absolute_change/$second; |
|
304
|
0
|
|
|
|
|
|
my $percentage = $relative_change * 100; |
|
305
|
0
|
|
|
|
|
|
return $percentage; |
|
306
|
|
|
|
|
|
|
} |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
1; |
|
309
|
|
|
|
|
|
|
__END__ |