← 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:01:06 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 {
2350358µs my $class = shift;
24 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 {
49532512.3ms my ( $self, $element ) = @_;
50 my $name = $element->{ LocalName };
5125263µ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' ) {
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 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 {
671072617.5ms my ( $self, $element ) = @_;
68 my $name = $element->{ LocalName };
69 if ( $name eq 'subfield' ) {
70 push @{ $self->{ subfields } }, $self->{ subcode };
71
72 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 } )
83642.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
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 },
9296030.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 );
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
10825272µs $self->{ record }->leader( $ldr );
# spent 272µs making 25 calls to MARC::Record::leader, avg 11µ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 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 {
118513015.4ms 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
12713µs1;