| 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 | MARC::File::SAX::end_element |
| 365598 | 1 | 1 | 2.28s | 2.28s | MARC::File::SAX::characters |
| 185299 | 1 | 1 | 1.97s | 2.03s | MARC::File::SAX::start_element |
| 5000 | 1 | 1 | 40.2ms | 40.2ms | MARC::File::SAX::new |
| 5000 | 1 | 1 | 23.7ms | 23.7ms | MARC::File::SAX::record |
| 1 | 1 | 1 | 6.01ms | 6.86ms | MARC::File::SAX::BEGIN@12 |
| 1 | 1 | 1 | 2.33ms | 70.3ms | MARC::File::SAX::BEGIN@14 |
| 1 | 1 | 1 | 1.84ms | 13.7ms | MARC::File::SAX::BEGIN@10 |
| 1 | 1 | 1 | 21µs | 28µs | MARC::File::SAX::BEGIN@9 |
| 1 | 1 | 1 | 18µs | 23.0ms | MARC::File::SAX::BEGIN@11 |
| 1 | 1 | 1 | 16µs | 52µs | MARC::File::SAX::BEGIN@13 |
| 0 | 0 | 0 | 0s | 0s | MARC::File::SAX::records |
| 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 | 10000 | 46.1ms | 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 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 | 555897 | 1.95s | my ( $self, $element ) = @_; | ||
| 50 | my $name = $element->{ LocalName }; | ||||
| 51 | 178623 | 406ms | 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 | $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.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 | 555897 | 1.69s | my ( $self, $element ) = @_; | ||
| 68 | my $name = $element->{ LocalName }; | ||||
| 69 | 840278 | 2.05s | if ( $name eq 'subfield' ) { | ||
| 70 | push @{ $self->{ subfields } }, $self->{ subcode }; | ||||
| 71 | |||||
| 72 | 95758 | 177ms | 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 | 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 | $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.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 | $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 | 57.9ms | $self->{ record }->leader( $ldr ); # spent 57.9ms 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 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 | 731196 | 3.04s | 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; |