Filename | /usr/lib64/perl5/vendor_perl/5.16.0/x86_64-linux/XML/LibXML/SAX.pm |
Statements | Executed 58 statements in 6.05ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 97.0ms | 97.3ms | BEGIN@18 | XML::LibXML::SAX::
1 | 1 | 1 | 60.9ms | 203ms | BEGIN@17 | XML::LibXML::SAX::
2 | 1 | 1 | 324µs | 134ms | _parse_string | XML::LibXML::SAX::
2 | 1 | 1 | 247µs | 133ms | _parse | XML::LibXML::SAX::
2 | 1 | 1 | 159µs | 541µs | set_feature | XML::LibXML::SAX::
1 | 1 | 1 | 81µs | 180µs | BEGIN@12 | XML::LibXML::SAX::
1 | 1 | 1 | 70µs | 1.08ms | BEGIN@23 | XML::LibXML::SAX::
1 | 1 | 1 | 63µs | 647µs | BEGIN@20 | XML::LibXML::SAX::
1 | 1 | 1 | 60µs | 324µs | BEGIN@22 | XML::LibXML::SAX::
1 | 1 | 1 | 54µs | 286µs | BEGIN@13 | XML::LibXML::SAX::
0 | 0 | 0 | 0s | 0s | CLONE_SKIP | XML::LibXML::SAX::
0 | 0 | 0 | 0s | 0s | _parse_bytestream | XML::LibXML::SAX::
0 | 0 | 0 | 0s | 0s | _parse_characterstream | XML::LibXML::SAX::
0 | 0 | 0 | 0s | 0s | _parse_systemid | XML::LibXML::SAX::
0 | 0 | 0 | 0s | 0s | parse_chunk | XML::LibXML::SAX::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # $Id$ | ||||
2 | # | ||||
3 | # This is free software, you may use it and distribute it under the same terms as | ||||
4 | # Perl itself. | ||||
5 | # | ||||
6 | # Copyright 2001-2003 AxKit.com Ltd., 2002-2006 Christian Glahn, 2006-2009 Petr Pajas | ||||
7 | # | ||||
8 | # | ||||
9 | |||||
10 | package XML::LibXML::SAX; | ||||
11 | |||||
12 | 2 | 241µs | 2 | 278µs | # spent 180µs (81+98) within XML::LibXML::SAX::BEGIN@12 which was called:
# once (81µs+98µs) by XML::SAX::ParserFactory::parser at line 12 # spent 180µs making 1 call to XML::LibXML::SAX::BEGIN@12
# spent 98µs making 1 call to strict::import |
13 | 2 | 207µs | 2 | 519µs | # spent 286µs (54+233) within XML::LibXML::SAX::BEGIN@13 which was called:
# once (54µs+233µs) by XML::SAX::ParserFactory::parser at line 13 # spent 286µs making 1 call to XML::LibXML::SAX::BEGIN@13
# spent 233µs making 1 call to vars::import |
14 | |||||
15 | 1 | 4µs | $VERSION = "1.90"; # VERSION TEMPLATE: DO NOT CHANGE | ||
16 | |||||
17 | 2 | 646µs | 2 | 204ms | # spent 203ms (60.9+142) within XML::LibXML::SAX::BEGIN@17 which was called:
# once (60.9ms+142ms) by XML::SAX::ParserFactory::parser at line 17 # spent 203ms making 1 call to XML::LibXML::SAX::BEGIN@17
# spent 1.17ms making 1 call to XML::LibXML::import |
18 | 2 | 892µs | 1 | 97.3ms | # spent 97.3ms (97.0+267µs) within XML::LibXML::SAX::BEGIN@18 which was called:
# once (97.0ms+267µs) by XML::SAX::ParserFactory::parser at line 18 # spent 97.3ms making 1 call to XML::LibXML::SAX::BEGIN@18 |
19 | |||||
20 | 2 | 186µs | 2 | 1.23ms | # spent 647µs (63+584) within XML::LibXML::SAX::BEGIN@20 which was called:
# once (63µs+584µs) by XML::SAX::ParserFactory::parser at line 20 # spent 647µs making 1 call to XML::LibXML::SAX::BEGIN@20
# spent 584µs making 1 call to base::import |
21 | |||||
22 | 2 | 166µs | 2 | 588µs | # spent 324µs (60+264) within XML::LibXML::SAX::BEGIN@22 which was called:
# once (60µs+264µs) by XML::SAX::ParserFactory::parser at line 22 # spent 324µs making 1 call to XML::LibXML::SAX::BEGIN@22
# spent 264µs making 1 call to Exporter::import |
23 | 2 | 3.03ms | 2 | 2.09ms | # spent 1.08ms (70µs+1.01) within XML::LibXML::SAX::BEGIN@23 which was called:
# once (70µs+1.01ms) by XML::SAX::ParserFactory::parser at line 23 # spent 1.08ms making 1 call to XML::LibXML::SAX::BEGIN@23
# spent 1.01ms making 1 call to Exporter::import |
24 | |||||
25 | sub CLONE_SKIP { | ||||
26 | return $XML::LibXML::__threads_shared ? 0 : 1; | ||||
27 | } | ||||
28 | |||||
29 | # spent 541µs (159+382) within XML::LibXML::SAX::set_feature which was called 2 times, avg 271µs/call:
# 2 times (159µs+382µs) by XML::SAX::Base::new at line 2592 of XML/SAX/Base.pm, avg 271µs/call | ||||
30 | 2 | 13µs | my ($self, $feat, $val) = @_; | ||
31 | |||||
32 | 2 | 6µs | if ($feat eq 'http://xmlns.perl.org/sax/join-character-data') { | ||
33 | $self->{JOIN_CHARACTERS} = $val; | ||||
34 | return 1; | ||||
35 | } | ||||
36 | |||||
37 | 2 | 3µs | shift(@_); | ||
38 | 2 | 140µs | 2 | 382µs | return $self->SUPER::set_feature(@_); # spent 382µs making 2 calls to XML::SAX::Base::set_feature, avg 191µs/call |
39 | } | ||||
40 | |||||
41 | sub _parse_characterstream { | ||||
42 | my ( $self, $fh ) = @_; | ||||
43 | # this my catch the xml decl, so the parser won't get confused about | ||||
44 | # a possibly wrong encoding. | ||||
45 | croak( "not implemented yet" ); | ||||
46 | } | ||||
47 | |||||
48 | sub _parse_bytestream { | ||||
49 | my ( $self, $fh ) = @_; | ||||
50 | |||||
51 | $self->{ParserOptions}{LibParser} = XML::LibXML->new; | ||||
52 | $self->{ParserOptions}{ParseFunc} = \&XML::LibXML::parse_fh; | ||||
53 | $self->{ParserOptions}{ParseFuncParam} = $fh; | ||||
54 | $self->_parse; | ||||
55 | return $self->end_document({}); | ||||
56 | } | ||||
57 | |||||
58 | # spent 134ms (324µs+134) within XML::LibXML::SAX::_parse_string which was called 2 times, avg 67.1ms/call:
# 2 times (324µs+134ms) by XML::SAX::Base::parse at line 2609 of XML/SAX/Base.pm, avg 67.1ms/call | ||||
59 | 2 | 32µs | my ( $self, $string ) = @_; | ||
60 | # $self->{ParserOptions}{LibParser} = XML::LibXML->new; | ||||
61 | 2 | 62µs | 2 | 95µs | $self->{ParserOptions}{LibParser} = XML::LibXML->new() unless defined $self->{ParserOptions}{LibParser}; # spent 95µs making 2 calls to XML::LibXML::new, avg 48µs/call |
62 | 2 | 16µs | $self->{ParserOptions}{ParseFunc} = \&XML::LibXML::parse_string; | ||
63 | 2 | 64µs | $self->{ParserOptions}{ParseFuncParam} = $string; | ||
64 | 2 | 30µs | 2 | 133ms | $self->_parse; # spent 133ms making 2 calls to XML::LibXML::SAX::_parse, avg 66.7ms/call |
65 | 2 | 87µs | 2 | 290µs | return $self->end_document({}); # spent 290µs making 2 calls to XML::SAX::Base::end_document, avg 145µs/call |
66 | } | ||||
67 | |||||
68 | sub _parse_systemid { | ||||
69 | my $self = shift; | ||||
70 | $self->{ParserOptions}{LibParser} = XML::LibXML->new; | ||||
71 | $self->{ParserOptions}{ParseFunc} = \&XML::LibXML::parse_file; | ||||
72 | $self->{ParserOptions}{ParseFuncParam} = shift; | ||||
73 | $self->_parse; | ||||
74 | return $self->end_document({}); | ||||
75 | } | ||||
76 | |||||
77 | sub parse_chunk { | ||||
78 | my ( $self, $chunk ) = @_; | ||||
79 | $self->{ParserOptions}{LibParser} = XML::LibXML->new; | ||||
80 | $self->{ParserOptions}{ParseFunc} = \&XML::LibXML::parse_xml_chunk; | ||||
81 | $self->{ParserOptions}{LibParser}->{IS_FILTER}=1; # a hack to prevent parse_xml_chunk from issuing end_document | ||||
82 | $self->{ParserOptions}{ParseFuncParam} = $chunk; | ||||
83 | $self->_parse; | ||||
84 | return; | ||||
85 | } | ||||
86 | |||||
87 | # spent 133ms (247µs+133) within XML::LibXML::SAX::_parse which was called 2 times, avg 66.7ms/call:
# 2 times (247µs+133ms) by XML::LibXML::SAX::_parse_string at line 64, avg 66.7ms/call | ||||
88 | 2 | 6µs | my $self = shift; | ||
89 | 2 | 23µs | my $args = bless $self->{ParserOptions}, ref($self); | ||
90 | |||||
91 | 2 | 10µs | if (defined($self->{JOIN_CHARACTERS})) { | ||
92 | $args->{LibParser}->{JOIN_CHARACTERS} = $self->{JOIN_CHARACTERS}; | ||||
93 | } else { | ||||
94 | 2 | 15µs | $args->{LibParser}->{JOIN_CHARACTERS} = 0; | ||
95 | } | ||||
96 | |||||
97 | 2 | 30µs | 2 | 64µs | $args->{LibParser}->set_handler( $self ); # spent 64µs making 2 calls to XML::LibXML::set_handler, avg 32µs/call |
98 | 2 | 8µs | eval { | ||
99 | 2 | 34µs | 2 | 133ms | $args->{ParseFunc}->($args->{LibParser}, $args->{ParseFuncParam}); # spent 133ms making 2 calls to XML::LibXML::parse_string, avg 66.6ms/call |
100 | }; | ||||
101 | |||||
102 | 2 | 17µs | if ( $args->{LibParser}->{SAX}->{State} == 1 ) { | ||
103 | croak( "SAX Exception not implemented, yet; Data ended before document ended\n" ); | ||||
104 | } | ||||
105 | |||||
106 | # break a possible circular reference | ||||
107 | 2 | 26µs | 2 | 65µs | $args->{LibParser}->set_handler( undef ); # spent 65µs making 2 calls to XML::LibXML::set_handler, avg 32µs/call |
108 | 2 | 2µs | if ( $@ ) { | ||
109 | croak $@; | ||||
110 | } | ||||
111 | 2 | 36µs | return; | ||
112 | } | ||||
113 | |||||
114 | 1 | 16µs | 1; | ||
115 |