Filename | /usr/share/perl5/MARC/File/SAX.pm |
Statements | Executed 2972668 statements in 9.39s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
185299 | 1 | 1 | 3.71s | 9.08s | end_element | MARC::File::SAX::
365598 | 1 | 1 | 2.28s | 2.28s | characters | MARC::File::SAX::
185299 | 1 | 1 | 1.97s | 2.03s | start_element | MARC::File::SAX::
5000 | 1 | 1 | 40.2ms | 40.2ms | new | MARC::File::SAX::
5000 | 1 | 1 | 23.7ms | 23.7ms | record | MARC::File::SAX::
1 | 1 | 1 | 6.01ms | 6.86ms | BEGIN@12 | MARC::File::SAX::
1 | 1 | 1 | 2.33ms | 70.3ms | BEGIN@14 | MARC::File::SAX::
1 | 1 | 1 | 1.84ms | 13.7ms | BEGIN@10 | MARC::File::SAX::
1 | 1 | 1 | 21µs | 28µs | BEGIN@9 | MARC::File::SAX::
1 | 1 | 1 | 18µs | 23.0ms | BEGIN@11 | MARC::File::SAX::
1 | 1 | 1 | 16µs | 52µs | BEGIN@13 | 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 | 42µs | 2 | 35µs | # spent 28µs (21+7) within MARC::File::SAX::BEGIN@9 which was called:
# once (21µs+7µs) by MARC::File::XML::BEGIN@9 at line 9 # spent 28µs making 1 call to MARC::File::SAX::BEGIN@9
# spent 7µs making 1 call to strict::import |
10 | 3 | 162µs | 2 | 13.7ms | # spent 13.7ms (1.84+11.8) within MARC::File::SAX::BEGIN@10 which was called:
# once (1.84ms+11.8ms) by MARC::File::XML::BEGIN@9 at line 10 # spent 13.7ms making 1 call to MARC::File::SAX::BEGIN@10
# spent 40µs making 1 call to Exporter::import |
11 | 3 | 52µs | 2 | 46.0ms | # spent 23.0ms (18µs+23.0) within MARC::File::SAX::BEGIN@11 which was called:
# once (18µs+23.0ms) by MARC::File::XML::BEGIN@9 at line 11 # spent 23.0ms making 1 call to MARC::File::SAX::BEGIN@11
# spent 23.0ms making 1 call to base::import |
12 | 3 | 215µs | 2 | 6.92ms | # spent 6.86ms (6.01+845µs) within MARC::File::SAX::BEGIN@12 which was called:
# once (6.01ms+845µs) by MARC::File::XML::BEGIN@9 at line 12 # spent 6.86ms making 1 call to MARC::File::SAX::BEGIN@12
# spent 61µs making 1 call to Exporter::import |
13 | 3 | 44µs | 2 | 88µs | # spent 52µs (16+36) within MARC::File::SAX::BEGIN@13 which was called:
# once (16µs+36µs) by MARC::File::XML::BEGIN@9 at line 13 # spent 52µs making 1 call to MARC::File::SAX::BEGIN@13
# spent 36µs making 1 call to Exporter::import |
14 | 3 | 878µs | 2 | 70.4ms | # spent 70.3ms (2.33+67.9) within MARC::File::SAX::BEGIN@14 which was called:
# once (2.33ms+67.9ms) by MARC::File::XML::BEGIN@9 at line 14 # spent 70.3ms making 1 call to MARC::File::SAX::BEGIN@14
# spent 77µs making 1 call to Exporter::import |
15 | |||||
16 | =head2 new() | ||||
17 | |||||
- - | |||||
22 | # spent 40.2ms within MARC::File::SAX::new which was called 5000 times, avg 8µs/call:
# 5000 times (40.2ms+0s) by MARC::File::XML::decode at line 438 of MARC/File/XML.pm, avg 8µs/call | ||||
23 | 5000 | 6.48ms | my $class = shift; | ||
24 | 5000 | 39.7ms | 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 23.7ms within MARC::File::SAX::record which was called 5000 times, avg 5µs/call:
# 5000 times (23.7ms+0s) by MARC::File::XML::decode at line 447 of MARC/File/XML.pm, avg 5µs/call | ||||
45 | 5000 | 27.3ms | return shift->{records}[0]; | ||
46 | } | ||||
47 | |||||
48 | # spent 2.03s (1.97+53.9ms) within MARC::File::SAX::start_element which was called 185299 times, avg 11µs/call:
# 185299 times (1.97s+53.9ms) by XML::SAX::ExpatXS::Preload::__ANON__[/usr/lib/perl5/XML/SAX/ExpatXS/Preload.pm:230] at line 230 of XML/SAX/ExpatXS/Preload.pm, avg 11µs/call | ||||
49 | 185299 | 240ms | my ( $self, $element ) = @_; | ||
50 | 185299 | 275ms | my $name = $element->{ LocalName }; | ||
51 | 185299 | 1.44s | 5000 | 53.9ms | if ( $name eq 'record' ) { # spent 53.9ms making 5000 calls to MARC::Record::new, avg 11µ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 | 59541 | 137ms | $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value }; | ||
59 | 59541 | 123ms | $self->{ i1 } = $element->{ Attributes }{ '{}ind1' }{ Value }; | ||
60 | 59541 | 146ms | $self->{ i2 } = $element->{ Attributes }{ '{}ind2' }{ Value }; | ||
61 | } elsif ( $name eq 'subfield' ) { | ||||
62 | $self->{ subcode } = $element->{ Attributes }{ '{}code' }{ Value }; | ||||
63 | } | ||||
64 | } | ||||
65 | |||||
66 | # spent 9.08s (3.71+5.37) within MARC::File::SAX::end_element which was called 185299 times, avg 49µs/call:
# 185299 times (3.71s+5.37s) by XML::SAX::ExpatXS::Preload::__ANON__[/usr/lib/perl5/XML/SAX/ExpatXS/Preload.pm:41] at line 41 of XML/SAX/ExpatXS/Preload.pm, avg 49µs/call | ||||
67 | 185299 | 236ms | my ( $self, $element ) = @_; | ||
68 | 185299 | 262ms | my $name = $element->{ LocalName }; | ||
69 | 185299 | 1.19s | if ( $name eq 'subfield' ) { | ||
70 | 95758 | 196ms | push @{ $self->{ subfields } }, $self->{ subcode }; | ||
71 | |||||
72 | 95758 | 218ms | if ($self->{ transcode }) { | ||
73 | push @{ $self->{ subfields } }, utf8_to_marc8($self->{ chars }); | ||||
74 | } else { | ||||
75 | 95758 | 177ms | push @{ $self->{ subfields } }, $self->{ chars } ; | ||
76 | } | ||||
77 | |||||
78 | 95758 | 124ms | $self->{ chars } = ''; | ||
79 | 95758 | 156ms | $self->{ subcode } = ''; | ||
80 | } elsif ( $name eq 'controlfield' ) { | ||||
81 | $self->{ record }->append_fields( | ||||
82 | MARC::Field->new( $self->{ tag }, $self->{ chars } ) | ||||
83 | 20000 | 186ms | 40000 | 941ms | ); # spent 528ms making 20000 calls to MARC::Field::new, avg 26µs/call
# spent 413ms making 20000 calls to MARC::Record::append_fields, avg 21µs/call |
84 | 20000 | 27.5ms | $self->{ chars } = ''; | ||
85 | 20000 | 37.1ms | $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 | 59541 | 557ms | 119082 | 4.37s | @{ $self->{ subfields } } # spent 3.16s making 59541 calls to MARC::Field::new, avg 53µs/call
# spent 1.22s making 59541 calls to MARC::Record::append_fields, avg 20µs/call |
93 | ) | ||||
94 | ); | ||||
95 | 59541 | 81.9ms | $self->{ tag } = ''; | ||
96 | 59541 | 74.9ms | $self->{ i1 } = ''; | ||
97 | 59541 | 71.4ms | $self->{ i2 } = ''; | ||
98 | 59541 | 118ms | $self->{ subfields } = []; | ||
99 | 59541 | 115ms | $self->{ chars } = ''; | ||
100 | } elsif ( $name eq 'leader' ) { | ||||
101 | 5000 | 6.56ms | my $ldr = $self->{ chars }; | ||
102 | |||||
103 | 5000 | 12.1ms | $self->{ transcode }++ | ||
104 | if (substr($ldr,9,1) eq 'a' and $self->{toMARC8}); | ||||
105 | |||||
106 | 5000 | 5.73ms | substr($ldr,9,1,' ') if ($self->{ transcode }); | ||
107 | |||||
108 | 5000 | 22.0ms | 5000 | 57.9ms | $self->{ record }->leader( $ldr ); # spent 57.9ms making 5000 calls to MARC::Record::leader, avg 12µs/call |
109 | 5000 | 6.98ms | $self->{ chars } = ''; | ||
110 | 5000 | 10.4ms | $self->{ tag } = ''; | ||
111 | } elsif ( $name eq 'record' ) { | ||||
112 | 5000 | 10.3ms | push(@{ $self->{ records } }, $self->{ record }); | ||
113 | 5000 | 8.06ms | undef $self->{ record }; | ||
114 | } | ||||
115 | } | ||||
116 | |||||
117 | # spent 2.28s within MARC::File::SAX::characters which was called 365598 times, avg 6µs/call:
# 365598 times (2.28s+0s) by XML::SAX::ExpatXS::Preload::__ANON__[/usr/lib/perl5/XML/SAX/ExpatXS/Preload.pm:167] at line 167 of XML/SAX/ExpatXS/Preload.pm, avg 6µs/call | ||||
118 | 365598 | 477ms | my ( $self, $chars ) = @_; | ||
119 | 365598 | 2.56s | 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; |