← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 01.HTTP.t
  Run on Tue May 4 14:17:45 2010
Reported on Tue May 4 14:17:59 2010

File /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/XML/LibXML/SAX.pm
Statements Executed 68
Statement Execution Time 836µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11113.0ms13.0msXML::LibXML::SAX::::BEGIN@18XML::LibXML::SAX::BEGIN@18
1118.28ms21.4msXML::LibXML::SAX::::BEGIN@17XML::LibXML::SAX::BEGIN@17
31183µs3.80msXML::LibXML::SAX::::_parse_stringXML::LibXML::SAX::_parse_string
31166µs3.59msXML::LibXML::SAX::::_parseXML::LibXML::SAX::_parse
11118µs22µsXML::LibXML::SAX::::BEGIN@12XML::LibXML::SAX::BEGIN@12
11114µs161µsXML::LibXML::SAX::::BEGIN@23XML::LibXML::SAX::BEGIN@23
11112µs81µsXML::LibXML::SAX::::BEGIN@20XML::LibXML::SAX::BEGIN@20
1119µs57µsXML::LibXML::SAX::::BEGIN@22XML::LibXML::SAX::BEGIN@22
1119µs45µsXML::LibXML::SAX::::BEGIN@13XML::LibXML::SAX::BEGIN@13
0000s0sXML::LibXML::SAX::::CLONE_SKIPXML::LibXML::SAX::CLONE_SKIP
0000s0sXML::LibXML::SAX::::_parse_bytestreamXML::LibXML::SAX::_parse_bytestream
0000s0sXML::LibXML::SAX::::_parse_characterstreamXML::LibXML::SAX::_parse_characterstream
0000s0sXML::LibXML::SAX::::_parse_systemidXML::LibXML::SAX::_parse_systemid
0000s0sXML::LibXML::SAX::::parse_chunkXML::LibXML::SAX::parse_chunk
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# $Id: SAX.pm 785 2009-07-16 14:17:46Z pajas $
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
10package XML::LibXML::SAX;
11
12336µs225µs
# spent 22µs (18+3) within XML::LibXML::SAX::BEGIN@12 which was called # once (18µs+3µs) by XML::SAX::ParserFactory::parser at line 12
use strict;
# spent 22µs making 1 call to XML::LibXML::SAX::BEGIN@12 # spent 3µs making 1 call to strict::import
13334µs282µs
# spent 45µs (9+36) within XML::LibXML::SAX::BEGIN@13 which was called # once (9µs+36µs) by XML::SAX::ParserFactory::parser at line 13
use vars qw($VERSION @ISA);
# spent 45µs making 1 call to XML::LibXML::SAX::BEGIN@13 # spent 36µs making 1 call to vars::import
14
151600ns$VERSION = "1.70"; # VERSION TEMPLATE: DO NOT CHANGE
16
173127µs221.6ms
# spent 21.4ms (8.28+13.1) within XML::LibXML::SAX::BEGIN@17 which was called # once (8.28ms+13.1ms) by XML::SAX::ParserFactory::parser at line 17
use XML::LibXML;
# spent 21.4ms making 1 call to XML::LibXML::SAX::BEGIN@17 # spent 162µs making 1 call to XML::LibXML::import
183142µs113.0ms
# spent 13.0ms (13.0+48µs) within XML::LibXML::SAX::BEGIN@18 which was called # once (13.0ms+48µs) by XML::SAX::ParserFactory::parser at line 18
use XML::SAX::Base;
# spent 13.0ms making 1 call to XML::LibXML::SAX::BEGIN@18
19
20326µs2150µs
# spent 81µs (12+69) within XML::LibXML::SAX::BEGIN@20 which was called # once (12µs+69µs) by XML::SAX::ParserFactory::parser at line 20
use base qw(XML::SAX::Base);
# spent 81µs making 1 call to XML::LibXML::SAX::BEGIN@20 # spent 69µs making 1 call to base::import
21
22322µs2106µs
# spent 57µs (9+48) within XML::LibXML::SAX::BEGIN@22 which was called # once (9µs+48µs) by XML::SAX::ParserFactory::parser at line 22
use Carp;
# spent 57µs making 1 call to XML::LibXML::SAX::BEGIN@22 # spent 48µs making 1 call to Exporter::import
233321µs2308µs
# spent 161µs (14+147) within XML::LibXML::SAX::BEGIN@23 which was called # once (14µs+147µs) by XML::SAX::ParserFactory::parser at line 23
use IO::File;
# spent 161µs making 1 call to XML::LibXML::SAX::BEGIN@23 # spent 147µs making 1 call to Exporter::import
24
25sub CLONE_SKIP {
26 return $XML::LibXML::__threads_shared ? 0 : 1;
27}
28
29sub _parse_characterstream {
30 my ( $self, $fh ) = @_;
31 # this my catch the xml decl, so the parser won't get confused about
32 # a possibly wrong encoding.
33 croak( "not implemented yet" );
34}
35
36sub _parse_bytestream {
37 my ( $self, $fh ) = @_;
38 $self->{ParserOptions}{LibParser} = XML::LibXML->new;
39 $self->{ParserOptions}{ParseFunc} = \&XML::LibXML::parse_fh;
40 $self->{ParserOptions}{ParseFuncParam} = $fh;
41 $self->_parse;
42 return $self->end_document({});
43}
44
45
# spent 3.80ms (83µs+3.71) within XML::LibXML::SAX::_parse_string which was called 3 times, avg 1.27ms/call: # 3 times (83µs+3.71ms) by XML::SAX::Base::parse at line 2602 of XML/SAX/Base.pm, avg 1.27ms/call
sub _parse_string {
461871µs my ( $self, $string ) = @_;
47# $self->{ParserOptions}{LibParser} = XML::LibXML->new;
48 $self->{ParserOptions}{LibParser} = XML::LibXML->new() unless defined $self->{ParserOptions}{LibParser};
# spent 36µs making 3 calls to XML::LibXML::new, avg 12µs/call
49 $self->{ParserOptions}{ParseFunc} = \&XML::LibXML::parse_string;
50 $self->{ParserOptions}{ParseFuncParam} = $string;
51 $self->_parse;
# spent 3.59ms making 3 calls to XML::LibXML::SAX::_parse, avg 1.20ms/call
52 return $self->end_document({});
# spent 88µs making 3 calls to XML::SAX::Base::end_document, avg 30µs/call
53}
54
55sub _parse_systemid {
56 my $self = shift;
57 $self->{ParserOptions}{LibParser} = XML::LibXML->new;
58 $self->{ParserOptions}{ParseFunc} = \&XML::LibXML::parse_file;
59 $self->{ParserOptions}{ParseFuncParam} = shift;
60 $self->_parse;
61 return $self->end_document({});
62}
63
64sub parse_chunk {
65 my ( $self, $chunk ) = @_;
66 $self->{ParserOptions}{LibParser} = XML::LibXML->new;
67 $self->{ParserOptions}{ParseFunc} = \&XML::LibXML::parse_xml_chunk;
68 $self->{ParserOptions}{LibParser}->{IS_FILTER}=1; # a hack to prevent parse_xml_chunk from issuing end_document
69 $self->{ParserOptions}{ParseFuncParam} = $chunk;
70 $self->_parse;
71 return;
72}
73
74
# spent 3.59ms (66µs+3.52) within XML::LibXML::SAX::_parse which was called 3 times, avg 1.20ms/call: # 3 times (66µs+3.52ms) by XML::LibXML::SAX::_parse_string at line 51, avg 1.20ms/call
sub _parse {
752442µs my $self = shift;
76 my $args = bless $self->{ParserOptions}, ref($self);
77
78 $args->{LibParser}->set_handler( $self );
# spent 21µs making 3 calls to XML::LibXML::set_handler, avg 7µs/call
79311µs eval {
80 $args->{ParseFunc}->($args->{LibParser}, $args->{ParseFuncParam});
# spent 3.49ms making 3 calls to XML::LibXML::parse_string, avg 1.16ms/call
81 };
82
83 if ( $args->{LibParser}->{SAX}->{State} == 1 ) {
84 croak( "SAX Exception not implemented, yet; Data ended before document ended\n" );
85 }
86
87 # break a possible circular reference
88 $args->{LibParser}->set_handler( undef );
# spent 15µs making 3 calls to XML::LibXML::set_handler, avg 5µs/call
89 if ( $@ ) {
90 croak $@;
91 }
92 return;
93}
94
95
9614µs1;
97