Filename | /usr/share/perl5/MARC/File/SAX.pm |
Statements | Executed 21275 statements in 46.5ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1295 | 2 | 1 | 16.3ms | 50.3ms | end_element | MARC::File::SAX::
2565 | 2 | 1 | 11.5ms | 11.5ms | characters | MARC::File::SAX::
1295 | 2 | 1 | 10.5ms | 10.7ms | start_element | MARC::File::SAX::
1 | 1 | 1 | 1.80ms | 18.4ms | BEGIN@14 | MARC::File::SAX::
25 | 1 | 1 | 303µs | 303µs | new | MARC::File::SAX::
25 | 1 | 1 | 147µs | 147µs | record | MARC::File::SAX::
1 | 1 | 1 | 24µs | 34µs | BEGIN@9 | MARC::File::SAX::
1 | 1 | 1 | 21µs | 52µs | BEGIN@10 | MARC::File::SAX::
1 | 1 | 1 | 16µs | 77µs | BEGIN@11 | MARC::File::SAX::
1 | 1 | 1 | 14µs | 53µs | BEGIN@12 | MARC::File::SAX::
1 | 1 | 1 | 10µs | 28µs | BEGIN@13 | MARC::File::SAX::
0 | 0 | 0 | 0s | 0s | records | MARC::File::SAX::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package MARC::File::SAX; | ||||
2 | |||||
3 | =head1 NAME | ||||
4 | |||||
- - | |||||
9 | 3 | 42µs | 2 | 44µ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 # spent 34µs making 1 call to MARC::File::SAX::BEGIN@9
# spent 10µs making 1 call to strict::import |
10 | 3 | 52µs | 2 | 84µ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 # spent 52µs making 1 call to MARC::File::SAX::BEGIN@10
# spent 32µs making 1 call to Exporter::import |
11 | 3 | 30µs | 2 | 138µ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 # spent 77µs making 1 call to MARC::File::SAX::BEGIN@11
# spent 61µs making 1 call to base::import |
12 | 3 | 33µs | 2 | 92µ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 # spent 53µs making 1 call to MARC::File::SAX::BEGIN@12
# spent 39µs making 1 call to Exporter::import |
13 | 3 | 34µs | 2 | 47µ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 # spent 28µs making 1 call to MARC::File::SAX::BEGIN@13
# spent 18µs making 1 call to Exporter::import |
14 | 3 | 612µs | 2 | 18.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 # 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 | ||||
23 | 25 | 24µs | my $class = shift; | ||
24 | 25 | 333µs | 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 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 | ||||
45 | 25 | 166µ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 | ||||
49 | 1295 | 971µs | my ( $self, $element ) = @_; | ||
50 | 1295 | 1.02ms | my $name = $element->{ LocalName }; | ||
51 | 1295 | 7.87ms | 25 | 263µ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 | 480 | 1.03ms | $self->{ tag } = $element->{ Attributes }{ '{}tag' }{ Value }; | ||
59 | 480 | 699µs | $self->{ i1 } = $element->{ Attributes }{ '{}ind1' }{ Value }; | ||
60 | 480 | 738µ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 | ||||
67 | 1295 | 860µs | my ( $self, $element ) = @_; | ||
68 | 1295 | 941µs | my $name = $element->{ LocalName }; | ||
69 | 1295 | 5.60ms | if ( $name eq 'subfield' ) { | ||
70 | 733 | 1.19ms | push @{ $self->{ subfields } }, $self->{ subcode }; | ||
71 | |||||
72 | 733 | 658µs | if ($self->{ transcode }) { | ||
73 | push @{ $self->{ subfields } }, utf8_to_marc8($self->{ chars }); | ||||
74 | } else { | ||||
75 | 733 | 950µs | push @{ $self->{ subfields } }, $self->{ chars } ; | ||
76 | } | ||||
77 | |||||
78 | 733 | 401µs | $self->{ chars } = ''; | ||
79 | 733 | 398µs | $self->{ subcode } = ''; | ||
80 | } elsif ( $name eq 'controlfield' ) { | ||||
81 | $self->{ record }->append_fields( | ||||
82 | MARC::Field->new( $self->{ tag }, $self->{ chars } ) | ||||
83 | 32 | 315µs | 64 | 2.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 | 32 | 39µs | $self->{ chars } = ''; | ||
85 | 32 | 37µ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 }, | ||||
92 | 480 | 3.63ms | 960 | 30.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 | 480 | 388µs | $self->{ tag } = ''; | ||
96 | 480 | 291µs | $self->{ i1 } = ''; | ||
97 | 480 | 243µs | $self->{ i2 } = ''; | ||
98 | 480 | 665µs | $self->{ subfields } = []; | ||
99 | 480 | 494µs | $self->{ chars } = ''; | ||
100 | } elsif ( $name eq 'leader' ) { | ||||
101 | 25 | 32µs | my $ldr = $self->{ chars }; | ||
102 | |||||
103 | 25 | 82µs | $self->{ transcode }++ | ||
104 | if (substr($ldr,9,1) eq 'a' and $self->{toMARC8}); | ||||
105 | |||||
106 | 25 | 23µs | substr($ldr,9,1,' ') if ($self->{ transcode }); | ||
107 | |||||
108 | 25 | 108µs | 25 | 272µs | $self->{ record }->leader( $ldr ); # spent 272µs making 25 calls to MARC::Record::leader, avg 11µs/call |
109 | 25 | 23µs | $self->{ chars } = ''; | ||
110 | 25 | 30µs | $self->{ tag } = ''; | ||
111 | } elsif ( $name eq 'record' ) { | ||||
112 | 25 | 56µs | push(@{ $self->{ records } }, $self->{ record }); | ||
113 | 25 | 43µ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 | ||||
118 | 2565 | 1.61ms | my ( $self, $chars ) = @_; | ||
119 | 2565 | 13.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 | |||||
127 | 1 | 3µs | 1; |