← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 05.Domain_and_Item.t
  Run on Tue May 4 16:57:28 2010
Reported on Tue May 4 16:58:03 2010

File /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/XML/LibXML/SAX.pm
Statements Executed 638
Statement Execution Time 11.3ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11128.8ms253msXML::LibXML::SAX::::BEGIN@17XML::LibXML::SAX::BEGIN@17
11113.7ms13.8msXML::LibXML::SAX::::BEGIN@18XML::LibXML::SAX::BEGIN@18
41111.31ms66.9msXML::LibXML::SAX::::_parse_stringXML::LibXML::SAX::_parse_string
41111.08ms63.8msXML::LibXML::SAX::::_parseXML::LibXML::SAX::_parse
11134µs44µsXML::LibXML::SAX::::BEGIN@12XML::LibXML::SAX::BEGIN@12
11115µs88µsXML::LibXML::SAX::::BEGIN@13XML::LibXML::SAX::BEGIN@13
11114µs156µsXML::LibXML::SAX::::BEGIN@23XML::LibXML::SAX::BEGIN@23
11112µs84µsXML::LibXML::SAX::::BEGIN@20XML::LibXML::SAX::BEGIN@20
11110µs66µsXML::LibXML::SAX::::BEGIN@22XML::LibXML::SAX::BEGIN@22
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
12356µs254µs
# spent 44µs (34+10) within XML::LibXML::SAX::BEGIN@12 which was called # once (34µs+10µs) by XML::SAX::ParserFactory::parser at line 12
use strict;
# spent 44µs making 1 call to XML::LibXML::SAX::BEGIN@12 # spent 10µs making 1 call to strict::import
13361µs2160µs
# spent 88µs (15+73) within XML::LibXML::SAX::BEGIN@13 which was called # once (15µs+73µs) by XML::SAX::ParserFactory::parser at line 13
use vars qw($VERSION @ISA);
# spent 88µs making 1 call to XML::LibXML::SAX::BEGIN@13 # spent 73µs making 1 call to vars::import
14
151700ns$VERSION = "1.70"; # VERSION TEMPLATE: DO NOT CHANGE
16
1738.60ms2253ms
# spent 253ms (28.8+224) within XML::LibXML::SAX::BEGIN@17 which was called # once (28.8ms+224ms) by XML::SAX::ParserFactory::parser at line 17
use XML::LibXML;
# spent 253ms making 1 call to XML::LibXML::SAX::BEGIN@17 # spent 272µs making 1 call to XML::LibXML::import
183198µs113.8ms
# spent 13.8ms (13.7+80µs) within XML::LibXML::SAX::BEGIN@18 which was called # once (13.7ms+80µs) by XML::SAX::ParserFactory::parser at line 18
use XML::SAX::Base;
# spent 13.8ms making 1 call to XML::LibXML::SAX::BEGIN@18
19
20326µs2156µs
# spent 84µs (12+72) within XML::LibXML::SAX::BEGIN@20 which was called # once (12µs+72µs) by XML::SAX::ParserFactory::parser at line 20
use base qw(XML::SAX::Base);
# spent 84µs making 1 call to XML::LibXML::SAX::BEGIN@20 # spent 72µs making 1 call to base::import
21
22323µs2121µs
# spent 66µs (10+56) within XML::LibXML::SAX::BEGIN@22 which was called # once (10µs+56µs) by XML::SAX::ParserFactory::parser at line 22
use Carp;
# spent 66µs making 1 call to XML::LibXML::SAX::BEGIN@22 # spent 56µs making 1 call to Exporter::import
233316µs2298µs
# spent 156µs (14+142) within XML::LibXML::SAX::BEGIN@23 which was called # once (14µs+142µs) by XML::SAX::ParserFactory::parser at line 23
use IO::File;
# spent 156µs making 1 call to XML::LibXML::SAX::BEGIN@23 # spent 142µ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 66.9ms (1.31+65.6) within XML::LibXML::SAX::_parse_string which was called 41 times, avg 1.63ms/call: # 41 times (1.31ms+65.6ms) by XML::SAX::Base::parse at line 2602 of XML/SAX/Base.pm, avg 1.63ms/call
sub _parse_string {
462461.17ms my ( $self, $string ) = @_;
47# $self->{ParserOptions}{LibParser} = XML::LibXML->new;
48 $self->{ParserOptions}{LibParser} = XML::LibXML->new() unless defined $self->{ParserOptions}{LibParser};
# spent 439µs making 41 calls to XML::LibXML::new, avg 11µs/call
49 $self->{ParserOptions}{ParseFunc} = \&XML::LibXML::parse_string;
50 $self->{ParserOptions}{ParseFuncParam} = $string;
51 $self->_parse;
# spent 63.8ms making 41 calls to XML::LibXML::SAX::_parse, avg 1.56ms/call
52 return $self->end_document({});
# spent 1.28ms making 41 calls to XML::SAX::Base::end_document, avg 31µ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 63.8ms (1.08+62.8) within XML::LibXML::SAX::_parse which was called 41 times, avg 1.56ms/call: # 41 times (1.08ms+62.8ms) by XML::LibXML::SAX::_parse_string at line 51, avg 1.56ms/call
sub _parse {
75369862µs my $self = shift;
76 my $args = bless $self->{ParserOptions}, ref($self);
77
78 $args->{LibParser}->set_handler( $self );
# spent 350µs making 41 calls to XML::LibXML::set_handler, avg 9µs/call
79 eval {
80 $args->{ParseFunc}->($args->{LibParser}, $args->{ParseFuncParam});
# spent 62.2ms making 41 calls to XML::LibXML::parse_string, avg 1.52ms/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 232µs making 41 calls to XML::LibXML::set_handler, avg 6µs/call
89 if ( $@ ) {
90 croak $@;
91 }
92 return;
93}
94
95
9614µs1;
97