| 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 | MARC::File::SAX::characters |
| 185299 | 2 | 1 | 3.76s | 9.39s | MARC::File::SAX::end_element |
| 185299 | 2 | 1 | 2.11s | 2.17s | MARC::File::SAX::start_element |
| 5000 | 1 | 1 | 49.4ms | 49.4ms | MARC::File::SAX::new |
| 5000 | 1 | 1 | 26.7ms | 26.7ms | MARC::File::SAX::record |
| 1 | 1 | 1 | 6.41ms | 7.42ms | MARC::File::SAX::BEGIN@12 |
| 1 | 1 | 1 | 2.36ms | 71.0ms | MARC::File::SAX::BEGIN@14 |
| 1 | 1 | 1 | 1.93ms | 14.6ms | MARC::File::SAX::BEGIN@10 |
| 1 | 1 | 1 | 23µs | 29µs | MARC::File::SAX::BEGIN@9 |
| 1 | 1 | 1 | 20µs | 57µs | MARC::File::SAX::BEGIN@13 |
| 1 | 1 | 1 | 18µs | 23.7ms | MARC::File::SAX::BEGIN@11 |
| 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 | 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 | 5000 | 8.04ms | my $class = shift; | ||
| 24 | 5000 | 45.9ms | 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 | 185299 | 247ms | my ( $self, $element ) = @_; | ||
| 50 | 185299 | 258ms | my $name = $element->{ LocalName }; | ||
| 51 | 185299 | 1.50s | 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 | 59541 | 152ms | $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value }; | ||
| 59 | 59541 | 133ms | $self->{ i1 } = $element->{ Attributes }{ '{}ind1' }{ Value }; | ||
| 60 | 59541 | 159ms | $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 | 185299 | 236ms | my ( $self, $element ) = @_; | ||
| 68 | 185299 | 254ms | my $name = $element->{ LocalName }; | ||
| 69 | 185299 | 1.22s | if ( $name eq 'subfield' ) { | ||
| 70 | 95758 | 206ms | push @{ $self->{ subfields } }, $self->{ subcode }; | ||
| 71 | |||||
| 72 | 95758 | 220ms | if ($self->{ transcode }) { | ||
| 73 | push @{ $self->{ subfields } }, utf8_to_marc8($self->{ chars }); | ||||
| 74 | } else { | ||||
| 75 | 95758 | 184ms | push @{ $self->{ subfields } }, $self->{ chars } ; | ||
| 76 | } | ||||
| 77 | |||||
| 78 | 95758 | 125ms | $self->{ chars } = ''; | ||
| 79 | 95758 | 128ms | $self->{ subcode } = ''; | ||
| 80 | } elsif ( $name eq 'controlfield' ) { | ||||
| 81 | $self->{ record }->append_fields( | ||||
| 82 | MARC::Field->new( $self->{ tag }, $self->{ chars } ) | ||||
| 83 | 20000 | 189ms | 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 | 20000 | 28.8ms | $self->{ chars } = ''; | ||
| 85 | 20000 | 30.7ms | $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 | 583ms | 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 | 59541 | 86.3ms | $self->{ tag } = ''; | ||
| 96 | 59541 | 76.3ms | $self->{ i1 } = ''; | ||
| 97 | 59541 | 73.3ms | $self->{ i2 } = ''; | ||
| 98 | 59541 | 127ms | $self->{ subfields } = []; | ||
| 99 | 59541 | 94.5ms | $self->{ chars } = ''; | ||
| 100 | } elsif ( $name eq 'leader' ) { | ||||
| 101 | 5000 | 7.15ms | my $ldr = $self->{ chars }; | ||
| 102 | |||||
| 103 | 5000 | 14.5ms | $self->{ transcode }++ | ||
| 104 | if (substr($ldr,9,1) eq 'a' and $self->{toMARC8}); | ||||
| 105 | |||||
| 106 | 5000 | 5.98ms | substr($ldr,9,1,' ') if ($self->{ transcode }); | ||
| 107 | |||||
| 108 | 5000 | 24.5ms | 5000 | 60.7ms | $self->{ record }->leader( $ldr ); # spent 60.7ms making 5000 calls to MARC::Record::leader, avg 12µs/call |
| 109 | 5000 | 7.35ms | $self->{ chars } = ''; | ||
| 110 | 5000 | 8.65ms | $self->{ tag } = ''; | ||
| 111 | } elsif ( $name eq 'record' ) { | ||||
| 112 | 5000 | 11.9ms | push(@{ $self->{ records } }, $self->{ record }); | ||
| 113 | 5000 | 8.56ms | 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 | 607406 | 776ms | my ( $self, $chars ) = @_; | ||
| 119 | 607406 | 4.22s | 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; |