← Index
NYTProf Performance Profile   « block view • line view • sub view »
For conv.pl
  Run on Sun Nov 14 21:27:43 2010
Reported on Sun Nov 14 21:29:13 2010

Filename/usr/lib/perl5/XML/SAX/ExpatXS/Encoding.pm
StatementsExecuted 23 statements in 1.59ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111152µs52µsXML::SAX::ExpatXS::Encoding::::CORE:ftdir XML::SAX::ExpatXS::Encoding::CORE:ftdir (opcode)
11130µs110µsXML::SAX::ExpatXS::ContentModel::::BEGIN@74XML::SAX::ExpatXS::ContentModel::BEGIN@74
11122µs28µsXML::SAX::ExpatXS::Encoding::::BEGIN@4 XML::SAX::ExpatXS::Encoding::BEGIN@4
11119µs92µsXML::SAX::ExpatXS::Encoding::::BEGIN@7 XML::SAX::ExpatXS::Encoding::BEGIN@7
11114µs141µsXML::SAX::ExpatXS::Encoding::::BEGIN@5 XML::SAX::ExpatXS::Encoding::BEGIN@5
11114µs14µsXML::SAX::ExpatXS::Encoding::::BEGIN@6 XML::SAX::ExpatXS::Encoding::BEGIN@6
0000s0sXML::SAX::ExpatXS::ContentModel::::asStringXML::SAX::ExpatXS::ContentModel::asString
0000s0sXML::SAX::ExpatXS::ContentModel::::childrenXML::SAX::ExpatXS::ContentModel::children
0000s0sXML::SAX::ExpatXS::ContentModel::::isanyXML::SAX::ExpatXS::ContentModel::isany
0000s0sXML::SAX::ExpatXS::ContentModel::::ischoiceXML::SAX::ExpatXS::ContentModel::ischoice
0000s0sXML::SAX::ExpatXS::ContentModel::::isemptyXML::SAX::ExpatXS::ContentModel::isempty
0000s0sXML::SAX::ExpatXS::ContentModel::::ismixedXML::SAX::ExpatXS::ContentModel::ismixed
0000s0sXML::SAX::ExpatXS::ContentModel::::isnameXML::SAX::ExpatXS::ContentModel::isname
0000s0sXML::SAX::ExpatXS::ContentModel::::isseqXML::SAX::ExpatXS::ContentModel::isseq
0000s0sXML::SAX::ExpatXS::ContentModel::::nameXML::SAX::ExpatXS::ContentModel::name
0000s0sXML::SAX::ExpatXS::ContentModel::::quantXML::SAX::ExpatXS::ContentModel::quant
0000s0sXML::SAX::ExpatXS::ContentModel::::thiseqXML::SAX::ExpatXS::ContentModel::thiseq
0000s0sXML::SAX::ExpatXS::Encinfo::::DESTROY XML::SAX::ExpatXS::Encinfo::DESTROY
0000s0sXML::SAX::ExpatXS::Encoding::::load_encoding XML::SAX::ExpatXS::Encoding::load_encoding
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package XML::SAX::ExpatXS::Encoding;
2168µsrequire 5.004;
3
4345µs234µs
# spent 28µs (22+6) within XML::SAX::ExpatXS::Encoding::BEGIN@4 which was called: # once (22µs+6µs) by XML::SAX::ExpatXS::BEGIN@5 at line 4
use strict;
# spent 28µs making 1 call to XML::SAX::ExpatXS::Encoding::BEGIN@4 # spent 6µs making 1 call to strict::import
5341µs2268µs
# spent 141µs (14+127) within XML::SAX::ExpatXS::Encoding::BEGIN@5 which was called: # once (14µs+127µs) by XML::SAX::ExpatXS::BEGIN@5 at line 5
use vars qw(@ISA %Encoding_Table @Encoding_Path $have_File_Spec);
# spent 141µs making 1 call to XML::SAX::ExpatXS::Encoding::BEGIN@5 # spent 127µs making 1 call to vars::import
6348µs114µs
# spent 14µs within XML::SAX::ExpatXS::Encoding::BEGIN@6 which was called: # once (14µs+0s) by XML::SAX::ExpatXS::BEGIN@5 at line 6
use XML::SAX::ExpatXS;
# spent 14µs making 1 call to XML::SAX::ExpatXS::Encoding::BEGIN@6
73540µs2165µs
# spent 92µs (19+73) within XML::SAX::ExpatXS::Encoding::BEGIN@7 which was called: # once (19µs+73µs) by XML::SAX::ExpatXS::BEGIN@5 at line 7
use Carp;
# spent 92µs making 1 call to XML::SAX::ExpatXS::Encoding::BEGIN@7 # spent 73µs making 1 call to Exporter::import
8
911µsrequire DynaLoader;
10
1119µs@ISA = qw(DynaLoader);
12
13
1412µs$have_File_Spec = $INC{'File/Spec.pm'} || do 'File/Spec.pm';
15
1611µs%Encoding_Table = ();
1713µsif ($have_File_Spec) {
181150µs23598µs @Encoding_Path = (grep(-d $_,
# spent 544µs making 11 calls to File::Spec::Unix::catdir, avg 49µs/call # spent 52µs making 11 calls to XML::SAX::ExpatXS::Encoding::CORE:ftdir, avg 5µs/call # spent 2µs making 1 call to File::Spec::Unix::curdir
19 map(File::Spec->catdir($_, qw(XML SAX ExpatXS Encodings)),
20 @INC)),
21 File::Spec->curdir);
22}
23else {
24 @Encoding_Path = (grep(-d $_, map($_ . '/XML/SAX/ExpatXS/Encodings', @INC)), '.');
25}
26
27sub load_encoding {
28 my ($file) = @_;
29
30 $file =~ s!([^/]+)$!\L$1\E!;
31 $file .= '.enc' unless $file =~ /\.enc$/;
32 unless ($file =~ m!^/!) {
33 foreach (@Encoding_Path) {
34 my $tmp = ($have_File_Spec
35 ? File::Spec->catfile($_, $file)
36 : "$_/$file");
37 if (-e $tmp) {
38 $file = $tmp;
39 last;
40 }
41 }
42 }
43
44 local(*ENC);
45 open(ENC, $file) or croak("Couldn't open encmap $file:\n$!\n");
46 binmode(ENC);
47 my $data;
48 my $br = sysread(ENC, $data, -s $file);
49 croak("Trouble reading $file:\n$!\n")
50 unless defined($br);
51 close(ENC);
52
53 my $name = XML::SAX::ExpatXS::LoadEncoding($data, $br);
54 croak("$file isn't an encmap file")
55 unless defined($name);
56
57 $name;
58} # End load_encoding
59
60
61################################################################
62
63package XML::SAX::ExpatXS::Encinfo;
64
65sub DESTROY {
66 my $self = shift;
67 XML::SAX::ExpatXS::FreeEncoding($self);
68}
69
70
71################################################################
72
73package XML::SAX::ExpatXS::ContentModel;
743664µs2190µs
# spent 110µs (30+80) within XML::SAX::ExpatXS::ContentModel::BEGIN@74 which was called: # once (30µs+80µs) by XML::SAX::ExpatXS::BEGIN@5 at line 74
use overload '""' => \&asString, 'eq' => \&thiseq;
# spent 110µs making 1 call to XML::SAX::ExpatXS::ContentModel::BEGIN@74 # spent 80µs making 1 call to overload::import
75
76sub EMPTY () {1}
77sub ANY () {2}
78sub MIXED () {3}
79sub NAME () {4}
80sub CHOICE () {5}
81sub SEQ () {6}
82
83sub isempty {
84 return $_[0]->{Type} == EMPTY;
85}
86
87sub isany {
88 return $_[0]->{Type} == ANY;
89}
90
91sub ismixed {
92 return $_[0]->{Type} == MIXED;
93}
94
95sub isname {
96 return $_[0]->{Type} == NAME;
97}
98
99sub name {
100 return $_[0]->{Tag};
101}
102
103sub ischoice {
104 return $_[0]->{Type} == CHOICE;
105}
106
107sub isseq {
108 return $_[0]->{Type} == SEQ;
109}
110
111sub quant {
112 return $_[0]->{Quant};
113}
114
115sub children {
116 my $children = $_[0]->{Children};
117 if (defined $children) {
118 return @$children;
119 }
120 return undef;
121}
122
123sub asString {
124 my ($self) = @_;
125 my $ret;
126
127 if ($self->{Type} == NAME) {
128 $ret = $self->{Tag};
129 }
130 elsif ($self->{Type} == EMPTY) {
131 return "EMPTY";
132 }
133 elsif ($self->{Type} == ANY) {
134 return "ANY";
135 }
136 elsif ($self->{Type} == MIXED) {
137 $ret = '(#PCDATA';
138 foreach (@{$self->{Children}}) {
139 $ret .= '|' . $_;
140 }
141 $ret .= ')';
142 }
143 else {
144 my $sep = $self->{Type} == CHOICE ? '|' : ',';
145 $ret = '(' . join($sep, map { $_->asString } @{$self->{Children}}) . ')';
146 }
147
148 $ret .= $self->{Quant} if $self->{Quant};
149 return $ret;
150}
151
152sub thiseq {
153 my $self = shift;
154
155 return $self->asString eq $_[0];
156}
157
158
159122µs1;
160
161__END__
 
# spent 52µs within XML::SAX::ExpatXS::Encoding::CORE:ftdir which was called 11 times, avg 5µs/call: # 11 times (52µs+0s) by XML::SAX::ExpatXS::BEGIN@5 at line 18, avg 5µs/call
sub XML::SAX::ExpatXS::Encoding::CORE:ftdir; # opcode