← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 17:10:45 2013
Reported on Tue Oct 15 17:11:26 2013

Filename/usr/share/perl5/Text/CSV.pm
StatementsExecuted 86 statements in 1.62ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111120µs120µsText::CSV::::_set_methodsText::CSV::_set_methods
11183µs3.91msText::CSV::::_load_xsText::CSV::_load_xs
11140µs47µsText::CSV::::BEGIN@4Text::CSV::BEGIN@4
11125µs98µsText::CSV::::BEGIN@6Text::CSV::BEGIN@6
11112µs34µsText::CSV::::BEGIN@136Text::CSV::BEGIN@136
11111µs24µsText::CSV::::BEGIN@196Text::CSV::BEGIN@196
11110µs10µsText::CSV::::BEGIN@5Text::CSV::BEGIN@5
1117µs7µsText::CSV::::BEGIN@8Text::CSV::BEGIN@8
1113µs3µsText::CSV::::importText::CSV::import
0000s0sText::CSV::::AUTOLOADText::CSV::AUTOLOAD
0000s0sText::CSV::::_load_ppText::CSV::_load_pp
0000s0sText::CSV::::is_dynamicText::CSV::is_dynamic
0000s0sText::CSV::::is_ppText::CSV::is_pp
0000s0sText::CSV::::is_xsText::CSV::is_xs
0000s0sText::CSV::::moduleText::CSV::module
0000s0sText::CSV::::newText::CSV::new
0000s0sText::CSV::::require_xs_versionText::CSV::require_xs_version
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Text::CSV;
2
3
4354µs254µs
# spent 47µs (40+7) within Text::CSV::BEGIN@4 which was called: # once (40µs+7µs) by C4::Members::Attributes::BEGIN@23 at line 4
use strict;
# spent 47µs making 1 call to Text::CSV::BEGIN@4 # spent 7µs making 1 call to strict::import
5358µs110µs
# spent 10µs within Text::CSV::BEGIN@5 which was called: # once (10µs+0s) by C4::Members::Attributes::BEGIN@23 at line 5
use Carp ();
# spent 10µs making 1 call to Text::CSV::BEGIN@5
6373µs2171µs
# spent 98µs (25+73) within Text::CSV::BEGIN@6 which was called: # once (25µs+73µs) by C4::Members::Attributes::BEGIN@23 at line 6
use vars qw( $VERSION $DEBUG );
# spent 98µs making 1 call to Text::CSV::BEGIN@6 # spent 73µs making 1 call to vars::import
7
8
# spent 7µs within Text::CSV::BEGIN@8 which was called: # once (7µs+0s) by C4::Members::Attributes::BEGIN@23 at line 11
BEGIN {
926µs $VERSION = '1.18';
10 $DEBUG = 0;
111701µs17µs}
# spent 7µs making 1 call to Text::CSV::BEGIN@8
12
13# if use CSV_XS, requires version
1411µsmy $Module_XS = 'Text::CSV_XS';
151300nsmy $Module_PP = 'Text::CSV_PP';
161200nsmy $XS_Version = '0.72';
17
181200nsmy $Is_Dynamic = 0;
19
20# used in _load_xs and _load_pp
211200nsmy $Install_Dont_Die = 1; # When _load_xs fails to load XS, don't die.
221200nsmy $Install_Only = 2; # Don't call _set_methods()
23
24
25111µsmy @PublicMethods = qw/
26 version types quote_char escape_char sep_char eol always_quote binary allow_whitespace
27 keep_meta_info allow_loose_quotes allow_loose_escapes verbatim meta_info is_quoted is_binary eof
28 getline print parse combine fields string error_diag error_input status blank_is_undef empty_is_undef
29 getline_hr column_names bind_columns auto_diag quote_space quote_null
30 PV IV NV
31/;
32#
3311µsmy @UndocumentedXSMethods = qw/Combine Parse SetDiag/;
34
351300nsmy @UndocumentedPPMethods = qw//; # Currently empty
36
37
38# Check the environment variable to decide worker module.
39
401900nsunless ($Text::CSV::Worker) {
411400ns $Text::CSV::DEBUG and Carp::carp("Check used worker module...");
42
4313µs if ( exists $ENV{PERL_TEXT_CSV} ) {
44 if ($ENV{PERL_TEXT_CSV} eq '0' or $ENV{PERL_TEXT_CSV} eq 'Text::CSV_PP') {
45 _load_pp();
46 }
47 elsif ($ENV{PERL_TEXT_CSV} eq '1' or $ENV{PERL_TEXT_CSV} =~ /Text::CSV_XS\s*,\s*Text::CSV_PP/) {
48 _load_xs($Install_Dont_Die) or _load_pp();
49 }
50 elsif ($ENV{PERL_TEXT_CSV} eq '2' or $ENV{PERL_TEXT_CSV} eq 'Text::CSV_XS') {
51 _load_xs();
52 }
53 else {
54 Carp::croak "The value of environmental variable 'PERL_TEXT_CSV' is invalid.";
55 }
56 }
57 else {
5813µs13.91ms _load_xs($Install_Dont_Die) or _load_pp();
# spent 3.91ms making 1 call to Text::CSV::_load_xs
59 }
60
61}
62
- -
65
# spent 3µs within Text::CSV::import which was called: # once (3µs+0s) by C4::Members::Attributes::BEGIN@23 at line 23 of /usr/share/koha/lib/C4/Members/Attributes.pm
sub import {
6615µs my ($class, $option) = @_;
67}
68
- -
71sub new { # normal mode
72 my $proto = shift;
73 my $class = ref($proto) || $proto;
74
75 unless ( $proto ) { # for Text::CSV_XS/PP::new(0);
76 return eval qq| $Text::CSV::Worker\::new( \$proto ) |;
77 }
78
79 #if (ref $_[0] and $_[0]->{module}) {
80 # Carp::croak("Can't set 'module' in non dynamic mode.");
81 #}
82
83 if ( my $obj = $Text::CSV::Worker->new(@_) ) {
84 $obj->{_MODULE} = $Text::CSV::Worker;
85 bless $obj, $class;
86 return $obj;
87 }
88 else {
89 return;
90 }
91
92
93}
94
95
96sub require_xs_version { $XS_Version; }
97
98
99sub module {
100 my $proto = shift;
101 return !ref($proto) ? $Text::CSV::Worker
102 : ref($proto->{_MODULE}) ? ref($proto->{_MODULE}) : $proto->{_MODULE};
103}
104
10512µs*backend = *module;
106
107
108sub is_xs {
109 return $_[0]->module eq $Module_XS;
110}
111
112
113sub is_pp {
114 return $_[0]->module eq $Module_PP;
115}
116
117
118sub is_dynamic { $Is_Dynamic; }
119
120
121sub AUTOLOAD {
122 my $self = $_[0];
123 my $attr = $Text::CSV::AUTOLOAD;
124 $attr =~ s/.*:://;
125
126 return if $attr =~ /^[A-Z]+$/;
127 Carp::croak( "Can't locate method $attr" ) unless $attr =~ /^_/;
128
129 my $pkg = $Text::CSV::Worker;
130
131 my $method = "$pkg\::$attr";
132
133 $Text::CSV::DEBUG and Carp::carp("'$attr' is private method, so try to autoload...");
134
135 local $^W;
1363310µs255µs
# spent 34µs (12+21) within Text::CSV::BEGIN@136 which was called: # once (12µs+21µs) by C4::Members::Attributes::BEGIN@23 at line 136
no strict qw(refs);
# spent 34µs making 1 call to Text::CSV::BEGIN@136 # spent 21µs making 1 call to strict::unimport
137
138 *{"Text::CSV::$attr"} = *{"$pkg\::$attr"};
139
140 goto &$attr;
141}
142
- -
145
# spent 3.91ms (83µs+3.82) within Text::CSV::_load_xs which was called: # once (83µs+3.82ms) by C4::Members::Attributes::BEGIN@23 at line 58
sub _load_xs {
146883µs my $opt = shift;
147
148 $Text::CSV::DEBUG and Carp::carp "Load $Module_XS.";
149
150 eval qq| use $Module_XS $XS_Version |;
# spent 198µs executing statements in string eval
# includes 3.16ms spent executing 1 call to 1 sub defined therein.
151
152 if ($@) {
153 if (defined $opt and $opt & $Install_Dont_Die) {
154 $Text::CSV::DEBUG and Carp::carp "Can't load $Module_XS...($@)";
155 return 0;
156 }
157 Carp::croak $@;
158 }
159
160 push @Text::CSV::ISA, 'Text::CSV_XS';
161
162 unless (defined $opt and $opt & $Install_Only) {
1631120µs _set_methods( $Text::CSV::Worker = $Module_XS );
# spent 120µs making 1 call to Text::CSV::_set_methods
164 }
165
166 return 1;
167};
168
169
170sub _load_pp {
171 my $opt = shift;
172
173 $Text::CSV::DEBUG and Carp::carp "Load $Module_PP.";
174
175 eval qq| require $Module_PP |;
176 if ($@) {
177 Carp::croak $@;
178 }
179
180 push @Text::CSV::ISA, 'Text::CSV_PP';
181
182 unless (defined $opt and $opt & $Install_Only) {
183 _set_methods( $Text::CSV::Worker = $Module_PP );
184 }
185};
186
- -
190
# spent 120µs within Text::CSV::_set_methods which was called: # once (120µs+0s) by Text::CSV::_load_xs at line 163
sub _set_methods {
19145125µs my $class = shift;
192
193 #return;
194
195 local $^W;
1963152µs238µs
# spent 24µs (11+14) within Text::CSV::BEGIN@196 which was called: # once (11µs+14µs) by C4::Members::Attributes::BEGIN@23 at line 196
no strict qw(refs);
# spent 24µs making 1 call to Text::CSV::BEGIN@196 # spent 14µs making 1 call to strict::unimport
197
198 for my $method (@PublicMethods) {
199 *{"Text::CSV::$method"} = \&{"$class\::$method"};
200 }
201
202 if ($Text::CSV::Worker eq $Module_XS) {
203 for my $method (@UndocumentedXSMethods) {
204 *{"Text::CSV::$method"} = \&{"$Module_XS\::$method"};
205 }
206 }
207
208 if ($Text::CSV::Worker eq $Module_PP) {
209 for my $method (@UndocumentedPPMethods) {
210 *{"Text::CSV::$method"} = \&{"$Module_PP\::$method"};
211 }
212 }
213
214}
215
- -
218125µs1;
219__END__