← Index
NYTProf Performance Profile   « block view • line view • sub view »
For conv.pl
  Run on Sun Nov 14 21:14:18 2010
Reported on Sun Nov 14 21:17:51 2010

Filename/usr/share/perl5/MARC/File/SAX.pm
StatementsExecuted 3456284 statements in 11.5s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
607406213.76s3.76sMARC::File::SAX::::charactersMARC::File::SAX::characters
185299213.76s9.39sMARC::File::SAX::::end_elementMARC::File::SAX::end_element
185299212.11s2.17sMARC::File::SAX::::start_elementMARC::File::SAX::start_element
50001149.4ms49.4msMARC::File::SAX::::newMARC::File::SAX::new
50001126.7ms26.7msMARC::File::SAX::::recordMARC::File::SAX::record
1116.41ms7.42msMARC::File::SAX::::BEGIN@12MARC::File::SAX::BEGIN@12
1112.36ms71.0msMARC::File::SAX::::BEGIN@14MARC::File::SAX::BEGIN@14
1111.93ms14.6msMARC::File::SAX::::BEGIN@10MARC::File::SAX::BEGIN@10
11123µs29µsMARC::File::SAX::::BEGIN@9MARC::File::SAX::BEGIN@9
11120µs57µsMARC::File::SAX::::BEGIN@13MARC::File::SAX::BEGIN@13
11118µs23.7msMARC::File::SAX::::BEGIN@11MARC::File::SAX::BEGIN@11
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
- -
9344µs235µ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
use strict;
# spent 29µs making 1 call to MARC::File::SAX::BEGIN@9 # spent 6µs making 1 call to strict::import
103169µs214.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
use XML::SAX;
# spent 14.6ms making 1 call to MARC::File::SAX::BEGIN@10 # spent 45µs making 1 call to Exporter::import
11353µs247.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
use base qw( XML::SAX::Base );
# spent 23.7ms making 1 call to MARC::File::SAX::BEGIN@11 # spent 23.7ms making 1 call to base::import
123234µs27.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
use Data::Dumper;
# spent 7.42ms making 1 call to MARC::File::SAX::BEGIN@12 # spent 89µs making 1 call to Exporter::import
13346µs294µ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
use MARC::Record;
# spent 57µs making 1 call to MARC::File::SAX::BEGIN@13 # spent 37µs making 1 call to Exporter::import
143887µs271.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
use MARC::Charset qw(utf8_to_marc8);
# 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
sub new {
231000053.9ms 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 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
sub record {
45500029.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
sub start_element {
495558972.01s my ( $self, $element ) = @_;
50 my $name = $element->{ LocalName };
51178623443ms500062.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 $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 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
sub end_element {
675558971.71s my ( $self, $element ) = @_;
68 my $name = $element->{ LocalName };
698402782.06s if ( $name eq 'subfield' ) {
70 push @{ $self->{ subfields } }, $self->{ subcode };
71
7295758184ms 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 } )
8340000987ms );
# 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 $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 },
921190824.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 $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
108500060.7ms $self->{ record }->leader( $ldr );
# spent 60.7ms making 5000 calls to MARC::Record::leader, avg 12µ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 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
sub characters {
11812148125.00s 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
12715µs1;