← 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 11:58:52 2013
Reported on Tue Oct 15 12:02:13 2013

Filename/usr/share/perl5/MARC/File/SAX.pm
StatementsExecuted 21275 statements in 46.5ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
12952116.3ms50.3msMARC::File::SAX::::end_elementMARC::File::SAX::end_element
25652111.5ms11.5msMARC::File::SAX::::charactersMARC::File::SAX::characters
12952110.5ms10.7msMARC::File::SAX::::start_elementMARC::File::SAX::start_element
1111.80ms18.4msMARC::File::SAX::::BEGIN@14MARC::File::SAX::BEGIN@14
2511303µs303µsMARC::File::SAX::::newMARC::File::SAX::new
2511147µs147µsMARC::File::SAX::::recordMARC::File::SAX::record
11124µs34µsMARC::File::SAX::::BEGIN@9MARC::File::SAX::BEGIN@9
11121µs52µsMARC::File::SAX::::BEGIN@10MARC::File::SAX::BEGIN@10
11116µs77µsMARC::File::SAX::::BEGIN@11MARC::File::SAX::BEGIN@11
11114µs53µsMARC::File::SAX::::BEGIN@12MARC::File::SAX::BEGIN@12
11110µs28µ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
- -
9342µs244µs
# spent 34µs (24+10) within MARC::File::SAX::BEGIN@9 which was called: # once (24µs+10µs) by MARC::File::XML::BEGIN@9 at line 9
use strict;
# spent 34µs making 1 call to MARC::File::SAX::BEGIN@9 # spent 10µs making 1 call to strict::import
10352µs284µs
# spent 52µs (21+31) within MARC::File::SAX::BEGIN@10 which was called: # once (21µs+31µs) by MARC::File::XML::BEGIN@9 at line 10
use XML::SAX;
# spent 52µs making 1 call to MARC::File::SAX::BEGIN@10 # spent 32µs making 1 call to Exporter::import
11330µs2138µs
# spent 77µs (16+61) within MARC::File::SAX::BEGIN@11 which was called: # once (16µs+61µs) by MARC::File::XML::BEGIN@9 at line 11
use base qw( XML::SAX::Base );
# spent 77µs making 1 call to MARC::File::SAX::BEGIN@11 # spent 61µs making 1 call to base::import
12333µs292µs
# spent 53µs (14+39) within MARC::File::SAX::BEGIN@12 which was called: # once (14µs+39µs) by MARC::File::XML::BEGIN@9 at line 12
use Data::Dumper;
# spent 53µs making 1 call to MARC::File::SAX::BEGIN@12 # spent 39µs making 1 call to Exporter::import
13334µs247µs
# spent 28µs (10+18) within MARC::File::SAX::BEGIN@13 which was called: # once (10µs+18µs) by MARC::File::XML::BEGIN@9 at line 13
use MARC::Record;
# spent 28µs making 1 call to MARC::File::SAX::BEGIN@13 # spent 18µs making 1 call to Exporter::import
143612µs218.5ms
# spent 18.4ms (1.80+16.6) within MARC::File::SAX::BEGIN@14 which was called: # once (1.80ms+16.6ms) by MARC::File::XML::BEGIN@9 at line 14
use MARC::Charset qw(utf8_to_marc8);
# spent 18.4ms making 1 call to MARC::File::SAX::BEGIN@14 # spent 49µs making 1 call to Exporter::import
15
16=head2 new()
17
- -
22
# spent 303µs within MARC::File::SAX::new which was called 25 times, avg 12µs/call: # 25 times (303µs+0s) by MARC::File::XML::decode at line 438 of MARC/File/XML.pm, avg 12µs/call
sub new {
232524µs my $class = shift;
2425333µ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 147µs within MARC::File::SAX::record which was called 25 times, avg 6µs/call: # 25 times (147µs+0s) by MARC::File::XML::decode at line 447 of MARC/File/XML.pm, avg 6µs/call
sub record {
4525166µs return shift->{records}[0];
46}
47
48
# spent 10.7ms (10.5+264µs) within MARC::File::SAX::start_element which was called 1295 times, avg 8µs/call: # 1270 times (10.1ms+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 (389µs+264µs) by XML::SAX::Base::start_element at line 293 of XML/SAX/Base.pm, avg 26µs/call
sub start_element {
491295971µs my ( $self, $element ) = @_;
5012951.02ms my $name = $element->{ LocalName };
5112957.87ms25263µs if ( $name eq 'record' ) {
# spent 263µs making 25 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' ) {
584801.03ms $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value };
59480699µs $self->{ i1 } = $element->{ Attributes }{ '{}ind1' }{ Value };
60480738µs $self->{ i2 } = $element->{ Attributes }{ '{}ind2' }{ Value };
61 } elsif ( $name eq 'subfield' ) {
62 $self->{ subcode } = $element->{ Attributes }{ '{}code' }{ Value };
63 }
64}
65
66
# spent 50.3ms (16.3+34.0) within MARC::File::SAX::end_element which was called 1295 times, avg 39µs/call: # 1270 times (15.7ms+33.7ms) by XML::SAX::Base::__ANON__[/usr/share/perl5/XML/SAX/Base.pm:2201] at line 2201 of XML/SAX/Base.pm, avg 39µs/call # 25 times (565µs+272µs) by XML::SAX::Base::end_element at line 2202 of XML/SAX/Base.pm, avg 33µs/call
sub end_element {
671295860µs my ( $self, $element ) = @_;
681295941µs my $name = $element->{ LocalName };
6912955.60ms if ( $name eq 'subfield' ) {
707331.19ms push @{ $self->{ subfields } }, $self->{ subcode };
71
72733658µs if ($self->{ transcode }) {
73 push @{ $self->{ subfields } }, utf8_to_marc8($self->{ chars });
74 } else {
75733950µs push @{ $self->{ subfields } }, $self->{ chars } ;
76 }
77
78733401µs $self->{ chars } = '';
79733398µs $self->{ subcode } = '';
80 } elsif ( $name eq 'controlfield' ) {
81 $self->{ record }->append_fields(
82 MARC::Field->new( $self->{ tag }, $self->{ chars } )
8332315µs642.92ms );
# spent 2.23ms making 32 calls to MARC::Field::new, avg 70µs/call # spent 684µs making 32 calls to MARC::Record::append_fields, avg 21µs/call
843239µs $self->{ chars } = '';
853237µ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.63ms96030.8ms @{ $self->{ subfields } }
# spent 23.1ms making 480 calls to MARC::Field::new, avg 48µs/call # spent 7.68ms making 480 calls to MARC::Record::append_fields, avg 16µs/call
93 )
94 );
95480388µs $self->{ tag } = '';
96480291µs $self->{ i1 } = '';
97480243µs $self->{ i2 } = '';
98480665µs $self->{ subfields } = [];
99480494µs $self->{ chars } = '';
100 } elsif ( $name eq 'leader' ) {
1012532µs my $ldr = $self->{ chars };
102
1032582µs $self->{ transcode }++
104 if (substr($ldr,9,1) eq 'a' and $self->{toMARC8});
105
1062523µs substr($ldr,9,1,' ') if ($self->{ transcode });
107
10825108µs25272µs $self->{ record }->leader( $ldr );
# spent 272µs making 25 calls to MARC::Record::leader, avg 11µs/call
1092523µs $self->{ chars } = '';
1102530µs $self->{ tag } = '';
111 } elsif ( $name eq 'record' ) {
1122556µs push(@{ $self->{ records } }, $self->{ record });
1132543µs undef $self->{ record };
114 }
115}
116
117
# spent 11.5ms within MARC::File::SAX::characters which was called 2565 times, avg 4µs/call: # 2540 times (11.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 (177µs+0s) by XML::SAX::Base::characters at line 201 of XML/SAX/Base.pm, avg 7µs/call
sub characters {
11825651.61ms my ( $self, $chars ) = @_;
119256513.8ms 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;