| Filename | /usr/share/perl5/MARC/File/SAX.pm |
| Statements | Executed 21275 statements in 44.4ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1295 | 2 | 1 | 15.2ms | 46.2ms | MARC::File::SAX::end_element |
| 2565 | 2 | 1 | 10.5ms | 10.5ms | MARC::File::SAX::characters |
| 1295 | 2 | 1 | 10.0ms | 10.3ms | MARC::File::SAX::start_element |
| 1 | 1 | 1 | 2.52ms | 22.2ms | MARC::File::SAX::BEGIN@14 |
| 1 | 1 | 1 | 1.35ms | 2.75ms | MARC::File::SAX::BEGIN@10 |
| 25 | 1 | 1 | 385µs | 385µs | MARC::File::SAX::new |
| 25 | 1 | 1 | 166µs | 166µs | MARC::File::SAX::record |
| 1 | 1 | 1 | 24µs | 17.1ms | MARC::File::SAX::BEGIN@11 |
| 1 | 1 | 1 | 22µs | 89µs | MARC::File::SAX::BEGIN@12 |
| 1 | 1 | 1 | 18µs | 21µs | MARC::File::SAX::BEGIN@9 |
| 1 | 1 | 1 | 13µs | 33µ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 | 28µs | 2 | 25µs | # spent 21µs (18+4) within MARC::File::SAX::BEGIN@9 which was called:
# once (18µs+4µs) by MARC::File::XML::BEGIN@9 at line 9 # spent 21µs making 1 call to MARC::File::SAX::BEGIN@9
# spent 4µs making 1 call to strict::import |
| 10 | 3 | 126µs | 2 | 2.79ms | # spent 2.75ms (1.35+1.39) within MARC::File::SAX::BEGIN@10 which was called:
# once (1.35ms+1.39ms) by MARC::File::XML::BEGIN@9 at line 10 # spent 2.75ms making 1 call to MARC::File::SAX::BEGIN@10
# spent 49µs making 1 call to Exporter::import |
| 11 | 3 | 63µs | 2 | 34.2ms | # spent 17.1ms (24µs+17.1) within MARC::File::SAX::BEGIN@11 which was called:
# once (24µs+17.1ms) by MARC::File::XML::BEGIN@9 at line 11 # spent 17.1ms making 1 call to MARC::File::SAX::BEGIN@11
# spent 17.1ms making 1 call to base::import |
| 12 | 3 | 40µs | 2 | 156µs | # spent 89µs (22+67) within MARC::File::SAX::BEGIN@12 which was called:
# once (22µs+67µs) by MARC::File::XML::BEGIN@9 at line 12 # spent 89µs making 1 call to MARC::File::SAX::BEGIN@12
# spent 67µs making 1 call to Exporter::import |
| 13 | 3 | 33µs | 2 | 54µs | # spent 33µs (13+21) within MARC::File::SAX::BEGIN@13 which was called:
# once (13µs+21µs) by MARC::File::XML::BEGIN@9 at line 13 # spent 33µs making 1 call to MARC::File::SAX::BEGIN@13
# spent 21µs making 1 call to Exporter::import |
| 14 | 3 | 846µs | 2 | 22.3ms | # spent 22.2ms (2.52+19.7) within MARC::File::SAX::BEGIN@14 which was called:
# once (2.52ms+19.7ms) by MARC::File::XML::BEGIN@9 at line 14 # spent 22.2ms making 1 call to MARC::File::SAX::BEGIN@14
# spent 91µs making 1 call to Exporter::import |
| 15 | |||||
| 16 | =head2 new() | ||||
| 17 | |||||
| - - | |||||
| 22 | # spent 385µs within MARC::File::SAX::new which was called 25 times, avg 15µs/call:
# 25 times (385µs+0s) by MARC::File::XML::decode at line 438 of MARC/File/XML.pm, avg 15µs/call | ||||
| 23 | 25 | 52µs | my $class = shift; | ||
| 24 | 25 | 371µs | 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 166µs within MARC::File::SAX::record which was called 25 times, avg 7µs/call:
# 25 times (166µs+0s) by MARC::File::XML::decode at line 447 of MARC/File/XML.pm, avg 7µs/call | ||||
| 45 | 25 | 167µs | return shift->{records}[0]; | ||
| 46 | } | ||||
| 47 | |||||
| 48 | # spent 10.3ms (10.0+239µs) within MARC::File::SAX::start_element which was called 1295 times, avg 8µs/call:
# 1270 times (9.64ms+0s) by XML::SAX::Base::__ANON__[/usr/share/perl5/XML/SAX/Base.pm:292] at line 292 of XML/SAX/Base.pm, avg 8µs/call
# 25 times (405µs+239µs) by XML::SAX::Base::start_element at line 293 of XML/SAX/Base.pm, avg 26µs/call | ||||
| 49 | 1295 | 938µs | my ( $self, $element ) = @_; | ||
| 50 | 1295 | 1.03ms | my $name = $element->{ LocalName }; | ||
| 51 | 1295 | 7.66ms | 25 | 239µs | if ( $name eq 'record' ) { # spent 239µs making 25 calls to MARC::Record::new, avg 10µ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 | 480 | 867µs | $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value }; | ||
| 59 | 480 | 605µs | $self->{ i1 } = $element->{ Attributes }{ '{}ind1' }{ Value }; | ||
| 60 | 480 | 748µs | $self->{ i2 } = $element->{ Attributes }{ '{}ind2' }{ Value }; | ||
| 61 | } elsif ( $name eq 'subfield' ) { | ||||
| 62 | $self->{ subcode } = $element->{ Attributes }{ '{}code' }{ Value }; | ||||
| 63 | } | ||||
| 64 | } | ||||
| 65 | |||||
| 66 | # spent 46.2ms (15.2+31.0) within MARC::File::SAX::end_element which was called 1295 times, avg 36µs/call:
# 1270 times (14.7ms+30.7ms) by XML::SAX::Base::__ANON__[/usr/share/perl5/XML/SAX/Base.pm:2201] at line 2201 of XML/SAX/Base.pm, avg 36µs/call
# 25 times (486µs+231µs) by XML::SAX::Base::end_element at line 2202 of XML/SAX/Base.pm, avg 29µs/call | ||||
| 67 | 1295 | 738µs | my ( $self, $element ) = @_; | ||
| 68 | 1295 | 937µs | my $name = $element->{ LocalName }; | ||
| 69 | 1295 | 5.47ms | if ( $name eq 'subfield' ) { | ||
| 70 | 733 | 1.16ms | push @{ $self->{ subfields } }, $self->{ subcode }; | ||
| 71 | |||||
| 72 | 733 | 654µs | if ($self->{ transcode }) { | ||
| 73 | push @{ $self->{ subfields } }, utf8_to_marc8($self->{ chars }); | ||||
| 74 | } else { | ||||
| 75 | 733 | 1.06ms | push @{ $self->{ subfields } }, $self->{ chars } ; | ||
| 76 | } | ||||
| 77 | |||||
| 78 | 733 | 438µs | $self->{ chars } = ''; | ||
| 79 | 733 | 364µs | $self->{ subcode } = ''; | ||
| 80 | } elsif ( $name eq 'controlfield' ) { | ||||
| 81 | $self->{ record }->append_fields( | ||||
| 82 | MARC::Field->new( $self->{ tag }, $self->{ chars } ) | ||||
| 83 | 32 | 283µs | 64 | 2.59ms | ); # spent 1.90ms making 32 calls to MARC::Field::new, avg 60µs/call
# spent 685µs making 32 calls to MARC::Record::append_fields, avg 21µs/call |
| 84 | 32 | 39µs | $self->{ chars } = ''; | ||
| 85 | 32 | 32µs | $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 | 480 | 3.17ms | 960 | 28.1ms | @{ $self->{ subfields } } # spent 21.1ms making 480 calls to MARC::Field::new, avg 44µs/call
# spent 7.01ms making 480 calls to MARC::Record::append_fields, avg 15µs/call |
| 93 | ) | ||||
| 94 | ); | ||||
| 95 | 480 | 354µs | $self->{ tag } = ''; | ||
| 96 | 480 | 248µs | $self->{ i1 } = ''; | ||
| 97 | 480 | 230µs | $self->{ i2 } = ''; | ||
| 98 | 480 | 626µs | $self->{ subfields } = []; | ||
| 99 | 480 | 475µs | $self->{ chars } = ''; | ||
| 100 | } elsif ( $name eq 'leader' ) { | ||||
| 101 | 25 | 22µs | my $ldr = $self->{ chars }; | ||
| 102 | |||||
| 103 | 25 | 68µs | $self->{ transcode }++ | ||
| 104 | if (substr($ldr,9,1) eq 'a' and $self->{toMARC8}); | ||||
| 105 | |||||
| 106 | 25 | 24µs | substr($ldr,9,1,' ') if ($self->{ transcode }); | ||
| 107 | |||||
| 108 | 25 | 104µs | 25 | 231µs | $self->{ record }->leader( $ldr ); # spent 231µs making 25 calls to MARC::Record::leader, avg 9µs/call |
| 109 | 25 | 29µs | $self->{ chars } = ''; | ||
| 110 | 25 | 30µs | $self->{ tag } = ''; | ||
| 111 | } elsif ( $name eq 'record' ) { | ||||
| 112 | 25 | 55µs | push(@{ $self->{ records } }, $self->{ record }); | ||
| 113 | 25 | 30µs | undef $self->{ record }; | ||
| 114 | } | ||||
| 115 | } | ||||
| 116 | |||||
| 117 | # spent 10.5ms within MARC::File::SAX::characters which was called 2565 times, avg 4µs/call:
# 2540 times (10.3ms+0s) by XML::SAX::Base::__ANON__[/usr/share/perl5/XML/SAX/Base.pm:200] at line 200 of XML/SAX/Base.pm, avg 4µs/call
# 25 times (135µs+0s) by XML::SAX::Base::characters at line 201 of XML/SAX/Base.pm, avg 5µs/call | ||||
| 118 | 2565 | 1.47ms | my ( $self, $chars ) = @_; | ||
| 119 | 2565 | 12.7ms | 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 | 3µs | 1; |