| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Benchmark::Harness::Values; |
|
2
|
1
|
|
|
1
|
|
13
|
use base qw(Benchmark::Harness::Trace); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
177
|
|
|
3
|
1
|
|
|
1
|
|
13
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
76
|
|
|
4
|
1
|
|
|
1
|
|
11
|
use vars qw($VERSION); $VERSION = sprintf("%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
210
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=pod |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 Benchmark::Harness::Values |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head2 SYNOPSIS |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
A harness that records the input parameters and return values of each |
|
14
|
|
|
|
|
|
|
function in the target program. |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
See Benchmark::Harness, "Parameters", for instruction on how to configure |
|
17
|
|
|
|
|
|
|
a test harness, and use 'Values' as your harness name. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head2 REPORT |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
The report is an XML file with schema you can find in xsd/Values.xsd, |
|
22
|
|
|
|
|
|
|
or at http://schemas.benchmark-harness.org/Values.xsd |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This schema adds a list of sub-elements to each element you would |
|
25
|
|
|
|
|
|
|
find in the basic Trace.xsd. An illustration of that element: |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
The @n attribute is the index into the function's input parameter list. |
|
35
|
|
|
|
|
|
|
If @n="0", this is the return value of the function. |
|
36
|
|
|
|
|
|
|
The @v attribute is the value you would get by the expression "$_[@n]", |
|
37
|
|
|
|
|
|
|
i.e., the stringified value of the @n-th parameter. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 GETTING MORE |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
The reporting mechanism uses the Stringify method to generate the @v attribute. |
|
42
|
|
|
|
|
|
|
You can control what gets printed here when rendering objects (i.e., bless refs) |
|
43
|
|
|
|
|
|
|
with this simple but powerful gimmick. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Add the following to the module that defines your parameter(s)' object(s): |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
package MyClass; |
|
48
|
|
|
|
|
|
|
use overload '""' => \&stringify; |
|
49
|
|
|
|
|
|
|
sub stringify { |
|
50
|
|
|
|
|
|
|
my $self = shift; |
|
51
|
|
|
|
|
|
|
return 'MyClass::'.$self->{some_meaningful_value}; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Put your own specialized code in stringify() to render your MyClass |
|
55
|
|
|
|
|
|
|
objects in whatever form you would rather see them. |
|
56
|
|
|
|
|
|
|
Otherwise you will see something like "MyClass::HASH{0x1bf2cd8}"; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 SEE ALSO |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L, L |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
### ########################################################################### |
|
65
|
|
|
|
|
|
|
### ########################################################################### |
|
66
|
|
|
|
|
|
|
### ########################################################################### |
|
67
|
|
|
|
|
|
|
package Benchmark::Harness::Handler::Values; |
|
68
|
1
|
|
|
1
|
|
10
|
use base qw(Benchmark::Harness::Handler::Trace); |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
965
|
|
|
69
|
1
|
|
|
1
|
|
15
|
use Benchmark::Harness::Constants; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
653
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
### ########################################################################### |
|
72
|
|
|
|
|
|
|
#sub reportTraceInfo { |
|
73
|
|
|
|
|
|
|
# return Benchmark::Harness::Handler::Trace::reportTraceInfo(@_); |
|
74
|
|
|
|
|
|
|
#} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
### ########################################################################### |
|
77
|
|
|
|
|
|
|
#sub reportValueInfo { |
|
78
|
|
|
|
|
|
|
# return Benchmark::Harness::Handler::Trace::reportValueInfo(@_); |
|
79
|
|
|
|
|
|
|
#} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
### ########################################################################### |
|
82
|
|
|
|
|
|
|
# USAGE: Benchmark::Trace::MethodArguments('class::method', [, 'class::method' ] ) |
|
83
|
|
|
|
|
|
|
sub OnSubEntry { |
|
84
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
85
|
0
|
|
|
|
|
|
my $origMethod = shift; |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my $i=1; |
|
88
|
0
|
|
|
|
|
|
for ( @_ ) { |
|
89
|
0
|
0
|
|
|
|
|
$self->NamedObjects($i, $_) if defined $_; |
|
90
|
0
|
0
|
|
|
|
|
last if ( $i++ == 20 ); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
0
|
0
|
|
|
|
|
if ( scalar(@_) > 20 ) { |
|
93
|
|
|
|
|
|
|
#$self->print(""); |
|
94
|
|
|
|
|
|
|
}; |
|
95
|
0
|
|
|
|
|
|
$self->reportTraceInfo();#(shift, caller(1)); |
|
96
|
0
|
|
|
|
|
|
return @_; # return the input arguments unchanged. |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
### ########################################################################### |
|
100
|
|
|
|
|
|
|
# USAGE: Benchmark::Trace::MethodReturn('class::method', [, 'class::method' ] ) |
|
101
|
|
|
|
|
|
|
sub OnSubExit { |
|
102
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
103
|
0
|
|
|
|
|
|
my $origMethod = shift; |
|
104
|
|
|
|
|
|
|
|
|
105
|
0
|
0
|
|
|
|
|
if (wantarray) { |
|
106
|
0
|
|
|
|
|
|
my $i=1; |
|
107
|
0
|
|
|
|
|
|
for ( @_ ) { |
|
108
|
0
|
0
|
|
|
|
|
$self->NamedObjects($i, $_) if defined $_; |
|
109
|
0
|
0
|
|
|
|
|
last if ( $i++ == 20 ); |
|
110
|
|
|
|
|
|
|
} |
|
111
|
0
|
0
|
|
|
|
|
if ( scalar(@_) > 20 ) { |
|
112
|
|
|
|
|
|
|
#$self->print(""); |
|
113
|
|
|
|
|
|
|
}; |
|
114
|
|
|
|
|
|
|
} else { |
|
115
|
0
|
0
|
|
|
|
|
scalar $self->NamedObjects('0', $_[0]) if defined $_[0]; |
|
116
|
0
|
|
|
|
|
|
return $_[0]; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
0
|
|
|
|
|
|
return @_; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
### ########################################################################### |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 AUTHOR |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Glenn Wood, |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Copyright (C) 2004 Glenn Wood. All rights reserved. |
|
130
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
|
131
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; |