← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 17:10:45 2013
Reported on Tue Oct 15 17:12:37 2013

Filename/usr/share/perl5/MARC/File/SAX.pm
StatementsExecuted 21275 statements in 44.4ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
12952115.2ms46.2msMARC::File::SAX::::end_elementMARC::File::SAX::end_element
25652110.5ms10.5msMARC::File::SAX::::charactersMARC::File::SAX::characters
12952110.0ms10.3msMARC::File::SAX::::start_elementMARC::File::SAX::start_element
1112.52ms22.2msMARC::File::SAX::::BEGIN@14MARC::File::SAX::BEGIN@14
1111.35ms2.75msMARC::File::SAX::::BEGIN@10MARC::File::SAX::BEGIN@10
2511385µs385µsMARC::File::SAX::::newMARC::File::SAX::new
2511166µs166µsMARC::File::SAX::::recordMARC::File::SAX::record
11124µs17.1msMARC::File::SAX::::BEGIN@11MARC::File::SAX::BEGIN@11
11122µs89µsMARC::File::SAX::::BEGIN@12MARC::File::SAX::BEGIN@12
11118µs21µsMARC::File::SAX::::BEGIN@9MARC::File::SAX::BEGIN@9
11113µs33µsMARC::File::SAX::::BEGIN@13MARC::File::SAX::BEGIN@13
0000s0sMARC::File::SAX::::recordsMARC::File::SAX::records
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package MARC::File::SAX;
2
3=head1 NAME
4
- -
9328µs225µ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
use strict;
# spent 21µs making 1 call to MARC::File::SAX::BEGIN@9 # spent 4µs making 1 call to strict::import
103126µs22.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
use XML::SAX;
# spent 2.75ms making 1 call to MARC::File::SAX::BEGIN@10 # spent 49µs making 1 call to Exporter::import
11363µs234.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
use base qw( XML::SAX::Base );
# spent 17.1ms making 1 call to MARC::File::SAX::BEGIN@11 # spent 17.1ms making 1 call to base::import
12340µs2156µ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
use Data::Dumper;
# spent 89µs making 1 call to MARC::File::SAX::BEGIN@12 # spent 67µs making 1 call to Exporter::import
13333µs254µ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
use MARC::Record;
# spent 33µs making 1 call to MARC::File::SAX::BEGIN@13 # spent 21µs making 1 call to Exporter::import
143846µs222.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
use MARC::Charset qw(utf8_to_marc8);
# 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
sub new {
232552µs my $class = shift;
2425371µs return bless {records => []}, ref($class) || $class;
25}
26
27=head2 records()
28
- -
33sub 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
sub record {
4525167µ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
sub start_element {
491295938µs my ( $self, $element ) = @_;
5012951.03ms my $name = $element->{ LocalName };
5112957.66ms25239µ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' ) {
58480867µs $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value };
59480605µs $self->{ i1 } = $element->{ Attributes }{ '{}ind1' }{ Value };
60480748µ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
sub end_element {
671295738µs my ( $self, $element ) = @_;
681295937µs my $name = $element->{ LocalName };
6912955.47ms if ( $name eq 'subfield' ) {
707331.16ms push @{ $self->{ subfields } }, $self->{ subcode };
71
72733654µs if ($self->{ transcode }) {
73 push @{ $self->{ subfields } }, utf8_to_marc8($self->{ chars });
74 } else {
757331.06ms push @{ $self->{ subfields } }, $self->{ chars } ;
76 }
77
78733438µs $self->{ chars } = '';
79733364µs $self->{ subcode } = '';
80 } elsif ( $name eq 'controlfield' ) {
81 $self->{ record }->append_fields(
82 MARC::Field->new( $self->{ tag }, $self->{ chars } )
8332283µs642.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
843239µs $self->{ chars } = '';
853232µ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 },
924803.17ms96028.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 );
95480354µs $self->{ tag } = '';
96480248µs $self->{ i1 } = '';
97480230µs $self->{ i2 } = '';
98480626µs $self->{ subfields } = [];
99480475µs $self->{ chars } = '';
100 } elsif ( $name eq 'leader' ) {
1012522µs my $ldr = $self->{ chars };
102
1032568µs $self->{ transcode }++
104 if (substr($ldr,9,1) eq 'a' and $self->{toMARC8});
105
1062524µs substr($ldr,9,1,' ') if ($self->{ transcode });
107
10825104µs25231µs $self->{ record }->leader( $ldr );
# spent 231µs making 25 calls to MARC::Record::leader, avg 9µs/call
1092529µs $self->{ chars } = '';
1102530µs $self->{ tag } = '';
111 } elsif ( $name eq 'record' ) {
1122555µs push(@{ $self->{ records } }, $self->{ record });
1132530µ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
sub characters {
11825651.47ms my ( $self, $chars ) = @_;
119256512.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
12713µs1;