| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Parser::Readprofile; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Test::Parser::Readprofile - Perl module to parse output from readprofile. |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Test::Parser::Readprofile; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $parser = new Test::Parser::Readprofile; |
|
12
|
|
|
|
|
|
|
$parser->parse($text); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
This module transforms readprofile output into a hash that can be used to |
|
17
|
|
|
|
|
|
|
generate XML. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Also see L for functions available from the base class. |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
|
24
|
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
25787
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
37
|
|
|
26
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
27
|
1
|
|
|
1
|
|
571
|
use Test::Parser; |
|
|
1
|
|
|
|
|
13
|
|
|
|
1
|
|
|
|
|
30
|
|
|
28
|
1
|
|
|
1
|
|
2088
|
use XML::Simple; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
@Test::Parser::Readprofile::ISA = qw(Test::Parser); |
|
31
|
|
|
|
|
|
|
use base 'Test::Parser'; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
use fields qw( |
|
34
|
|
|
|
|
|
|
data |
|
35
|
|
|
|
|
|
|
time_units |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use vars qw( %FIELDS $AUTOLOAD $VERSION ); |
|
39
|
|
|
|
|
|
|
our $VERSION = '1.7'; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 new() |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Creates a new Test::Parser::Readprofile instance. |
|
44
|
|
|
|
|
|
|
Also calls the Test::Parser base class' new() routine. |
|
45
|
|
|
|
|
|
|
Takes no arguments. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub new { |
|
50
|
|
|
|
|
|
|
my $class = shift; |
|
51
|
|
|
|
|
|
|
my Test::Parser::Readprofile $self = fields::new($class); |
|
52
|
|
|
|
|
|
|
$self->SUPER::new(); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$self->name('readprofile'); |
|
55
|
|
|
|
|
|
|
$self->type('standards'); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# |
|
58
|
|
|
|
|
|
|
# Readprofile data in an array. |
|
59
|
|
|
|
|
|
|
# |
|
60
|
|
|
|
|
|
|
$self->{data} = []; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
return $self; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head3 data() |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Returns a hash representation of the readprofile data. |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
|
70
|
|
|
|
|
|
|
sub data { |
|
71
|
|
|
|
|
|
|
my $self = shift; |
|
72
|
|
|
|
|
|
|
if (@_) { |
|
73
|
|
|
|
|
|
|
$self->{data} = @_; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
return {readprofile => {symbol => $self->{data}}}; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head3 |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Override of Test::Parser's default parse_line() routine to make it able |
|
81
|
|
|
|
|
|
|
to parse readprofile output. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
|
84
|
|
|
|
|
|
|
sub parse_line { |
|
85
|
|
|
|
|
|
|
my $self = shift; |
|
86
|
|
|
|
|
|
|
my $line = shift; |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# |
|
89
|
|
|
|
|
|
|
# Trim any leading and trailing whitespaces. |
|
90
|
|
|
|
|
|
|
# |
|
91
|
|
|
|
|
|
|
$line =~ s/^\s+//; |
|
92
|
|
|
|
|
|
|
chomp($line); |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my @i = split / +/, $line; |
|
95
|
|
|
|
|
|
|
push @{$self->{data}}, {ticks => $i[0], name => $i[1], load => $i[2]} |
|
96
|
|
|
|
|
|
|
if (scalar @i == 3); |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
return 1; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head3 to_xml() |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Returns readprofile data transformed into XML. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
|
106
|
|
|
|
|
|
|
sub to_xml { |
|
107
|
|
|
|
|
|
|
my $self = shift; |
|
108
|
|
|
|
|
|
|
my $outfile = shift; |
|
109
|
|
|
|
|
|
|
return XMLout({symbol => $self->{data}}, RootName => 'readprofile'); |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
|
113
|
|
|
|
|
|
|
__END__ |