Filename | /usr/share/perl5/MARC/File/SAX.pm |
Statements | Executed 3456284 statements in 11.5s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
607406 | 2 | 1 | 3.76s | 3.76s | characters | MARC::File::SAX::
185299 | 2 | 1 | 3.76s | 9.39s | end_element | MARC::File::SAX::
185299 | 2 | 1 | 2.11s | 2.17s | start_element | MARC::File::SAX::
5000 | 1 | 1 | 49.4ms | 49.4ms | new | MARC::File::SAX::
5000 | 1 | 1 | 26.7ms | 26.7ms | record | MARC::File::SAX::
1 | 1 | 1 | 6.41ms | 7.42ms | BEGIN@12 | MARC::File::SAX::
1 | 1 | 1 | 2.36ms | 71.0ms | BEGIN@14 | MARC::File::SAX::
1 | 1 | 1 | 1.93ms | 14.6ms | BEGIN@10 | MARC::File::SAX::
1 | 1 | 1 | 23µs | 29µs | BEGIN@9 | MARC::File::SAX::
1 | 1 | 1 | 20µs | 57µs | BEGIN@13 | MARC::File::SAX::
1 | 1 | 1 | 18µs | 23.7ms | BEGIN@11 | MARC::File::SAX::
0 | 0 | 0 | 0s | 0s | records | MARC::File::SAX::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package MARC::File::SAX; | ||||
2 | |||||
3 | =head1 NAME | ||||
4 | |||||
- - | |||||
9 | 3 | 44µs | 2 | 35µs | # spent 29µs (23+6) within MARC::File::SAX::BEGIN@9 which was called:
# once (23µs+6µs) by MARC::File::XML::BEGIN@9 at line 9 # spent 29µs making 1 call to MARC::File::SAX::BEGIN@9
# spent 6µs making 1 call to strict::import |
10 | 3 | 169µs | 2 | 14.7ms | # spent 14.6ms (1.93+12.7) within MARC::File::SAX::BEGIN@10 which was called:
# once (1.93ms+12.7ms) by MARC::File::XML::BEGIN@9 at line 10 # spent 14.6ms making 1 call to MARC::File::SAX::BEGIN@10
# spent 45µs making 1 call to Exporter::import |
11 | 3 | 53µs | 2 | 47.4ms | # spent 23.7ms (18µs+23.7) within MARC::File::SAX::BEGIN@11 which was called:
# once (18µs+23.7ms) by MARC::File::XML::BEGIN@9 at line 11 # spent 23.7ms making 1 call to MARC::File::SAX::BEGIN@11
# spent 23.7ms making 1 call to base::import |
12 | 3 | 234µs | 2 | 7.51ms | # spent 7.42ms (6.41+1.01) within MARC::File::SAX::BEGIN@12 which was called:
# once (6.41ms+1.01ms) by MARC::File::XML::BEGIN@9 at line 12 # spent 7.42ms making 1 call to MARC::File::SAX::BEGIN@12
# spent 89µs making 1 call to Exporter::import |
13 | 3 | 46µs | 2 | 94µs | # spent 57µs (20+37) within MARC::File::SAX::BEGIN@13 which was called:
# once (20µs+37µs) by MARC::File::XML::BEGIN@9 at line 13 # spent 57µs making 1 call to MARC::File::SAX::BEGIN@13
# spent 37µs making 1 call to Exporter::import |
14 | 3 | 887µs | 2 | 71.1ms | # spent 71.0ms (2.36+68.7) within MARC::File::SAX::BEGIN@14 which was called:
# once (2.36ms+68.7ms) by MARC::File::XML::BEGIN@9 at line 14 # spent 71.0ms making 1 call to MARC::File::SAX::BEGIN@14
# spent 79µs making 1 call to Exporter::import |
15 | |||||
16 | =head2 new() | ||||
17 | |||||
- - | |||||
22 | # spent 49.4ms within MARC::File::SAX::new which was called 5000 times, avg 10µs/call:
# 5000 times (49.4ms+0s) by MARC::File::XML::decode at line 438 of MARC/File/XML.pm, avg 10µs/call | ||||
23 | 10000 | 53.9ms | my $class = shift; | ||
24 | return bless {records => []}, ref($class) || $class; | ||||
25 | } | ||||
26 | |||||
27 | =head2 records() | ||||
28 | |||||
- - | |||||
33 | sub records { | ||||
34 | return shift->{records}; | ||||
35 | } | ||||
36 | |||||
37 | =head2 record() | ||||
38 | |||||
- - | |||||
44 | # spent 26.7ms within MARC::File::SAX::record which was called 5000 times, avg 5µs/call:
# 5000 times (26.7ms+0s) by MARC::File::XML::decode at line 447 of MARC/File/XML.pm, avg 5µs/call | ||||
45 | 5000 | 29.3ms | return shift->{records}[0]; | ||
46 | } | ||||
47 | |||||
48 | # spent 2.17s (2.11+62.0ms) within MARC::File::SAX::start_element which was called 185299 times, avg 12µs/call:
# 180299 times (2.04s+0s) by XML::SAX::Base::__ANON__[/usr/share/perl5/XML/SAX/Base.pm:292] at line 292 of XML/SAX/Base.pm, avg 11µs/call
# 5000 times (70.7ms+62.0ms) by XML::SAX::Base::start_element at line 293 of XML/SAX/Base.pm, avg 27µs/call | ||||
49 | 555897 | 2.01s | my ( $self, $element ) = @_; | ||
50 | my $name = $element->{ LocalName }; | ||||
51 | 178623 | 443ms | 5000 | 62.0ms | if ( $name eq 'record' ) { # spent 62.0ms making 5000 calls to MARC::Record::new, avg 12µs/call |
52 | $self->{ record } = MARC::Record->new(); | ||||
53 | } elsif ( $name eq 'leader' ) { | ||||
54 | $self->{ tag } = 'LDR'; | ||||
55 | } elsif ( $name eq 'controlfield' ) { | ||||
56 | $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value }; | ||||
57 | } elsif ( $name eq 'datafield' ) { | ||||
58 | $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value }; | ||||
59 | $self->{ i1 } = $element->{ Attributes }{ '{}ind1' }{ Value }; | ||||
60 | $self->{ i2 } = $element->{ Attributes }{ '{}ind2' }{ Value }; | ||||
61 | } elsif ( $name eq 'subfield' ) { | ||||
62 | $self->{ subcode } = $element->{ Attributes }{ '{}code' }{ Value }; | ||||
63 | } | ||||
64 | } | ||||
65 | |||||
66 | # spent 9.39s (3.76+5.63) within MARC::File::SAX::end_element which was called 185299 times, avg 51µs/call:
# 180299 times (3.64s+5.57s) by XML::SAX::Base::__ANON__[/usr/share/perl5/XML/SAX/Base.pm:2201] at line 2201 of XML/SAX/Base.pm, avg 51µs/call
# 5000 times (119ms+60.7ms) by XML::SAX::Base::end_element at line 2202 of XML/SAX/Base.pm, avg 36µs/call | ||||
67 | 555897 | 1.71s | my ( $self, $element ) = @_; | ||
68 | my $name = $element->{ LocalName }; | ||||
69 | 840278 | 2.06s | if ( $name eq 'subfield' ) { | ||
70 | push @{ $self->{ subfields } }, $self->{ subcode }; | ||||
71 | |||||
72 | 95758 | 184ms | if ($self->{ transcode }) { | ||
73 | push @{ $self->{ subfields } }, utf8_to_marc8($self->{ chars }); | ||||
74 | } else { | ||||
75 | push @{ $self->{ subfields } }, $self->{ chars } ; | ||||
76 | } | ||||
77 | |||||
78 | $self->{ chars } = ''; | ||||
79 | $self->{ subcode } = ''; | ||||
80 | } elsif ( $name eq 'controlfield' ) { | ||||
81 | $self->{ record }->append_fields( | ||||
82 | MARC::Field->new( $self->{ tag }, $self->{ chars } ) | ||||
83 | 40000 | 987ms | ); # spent 567ms making 20000 calls to MARC::Field::new, avg 28µs/call
# spent 421ms making 20000 calls to MARC::Record::append_fields, avg 21µs/call | ||
84 | $self->{ chars } = ''; | ||||
85 | $self->{ tag } = ''; | ||||
86 | } elsif ( $name eq 'datafield' ) { | ||||
87 | $self->{ record }->append_fields( | ||||
88 | MARC::Field->new( | ||||
89 | $self->{ tag }, | ||||
90 | $self->{ i1 }, | ||||
91 | $self->{ i2 }, | ||||
92 | 119082 | 4.58s | @{ $self->{ subfields } } # spent 3.31s making 59541 calls to MARC::Field::new, avg 56µs/call
# spent 1.27s making 59541 calls to MARC::Record::append_fields, avg 21µs/call | ||
93 | ) | ||||
94 | ); | ||||
95 | $self->{ tag } = ''; | ||||
96 | $self->{ i1 } = ''; | ||||
97 | $self->{ i2 } = ''; | ||||
98 | $self->{ subfields } = []; | ||||
99 | $self->{ chars } = ''; | ||||
100 | } elsif ( $name eq 'leader' ) { | ||||
101 | my $ldr = $self->{ chars }; | ||||
102 | |||||
103 | $self->{ transcode }++ | ||||
104 | if (substr($ldr,9,1) eq 'a' and $self->{toMARC8}); | ||||
105 | |||||
106 | substr($ldr,9,1,' ') if ($self->{ transcode }); | ||||
107 | |||||
108 | 5000 | 60.7ms | $self->{ record }->leader( $ldr ); # spent 60.7ms making 5000 calls to MARC::Record::leader, avg 12µs/call | ||
109 | $self->{ chars } = ''; | ||||
110 | $self->{ tag } = ''; | ||||
111 | } elsif ( $name eq 'record' ) { | ||||
112 | push(@{ $self->{ records } }, $self->{ record }); | ||||
113 | undef $self->{ record }; | ||||
114 | } | ||||
115 | } | ||||
116 | |||||
117 | # spent 3.76s within MARC::File::SAX::characters which was called 607406 times, avg 6µs/call:
# 602406 times (3.73s+0s) by XML::SAX::Base::__ANON__[/usr/share/perl5/XML/SAX/Base.pm:200] at line 200 of XML/SAX/Base.pm, avg 6µs/call
# 5000 times (29.1ms+0s) by XML::SAX::Base::characters at line 201 of XML/SAX/Base.pm, avg 6µs/call | ||||
118 | 1214812 | 5.00s | my ( $self, $chars ) = @_; | ||
119 | if ( | ||||
120 | ( exists $self->{ subcode } && $self->{ subcode } ne '') | ||||
121 | || ( $self->{ tag } && ( $self->{ tag } eq 'LDR' || $self->{ tag } < 10 )) | ||||
122 | ) { | ||||
123 | $self->{ chars } .= $chars->{ Data }; | ||||
124 | } | ||||
125 | } | ||||
126 | |||||
127 | 1 | 5µs | 1; |