← 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 11:58:52 2013
Reported on Tue Oct 15 12:02:19 2013

Filename/usr/share/perl5/Text/CSV.pm
StatementsExecuted 86 statements in 1.46ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111120µs120µsText::CSV::::_set_methodsText::CSV::_set_methods
11170µs3.84msText::CSV::::_load_xsText::CSV::_load_xs
11116µs72µsText::CSV::::BEGIN@6Text::CSV::BEGIN@6
11116µs20µsText::CSV::::BEGIN@4Text::CSV::BEGIN@4
11112µs33µsText::CSV::::BEGIN@136Text::CSV::BEGIN@136
11111µs26µsText::CSV::::BEGIN@196Text::CSV::BEGIN@196
1116µs6µsText::CSV::::BEGIN@8Text::CSV::BEGIN@8
1115µs5µsText::CSV::::BEGIN@5Text::CSV::BEGIN@5
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
4326µs224µs
# spent 20µs (16+4) within Text::CSV::BEGIN@4 which was called: # once (16µs+4µs) by C4::Members::Attributes::BEGIN@23 at line 4
use strict;
# spent 20µs making 1 call to Text::CSV::BEGIN@4 # spent 4µs making 1 call to strict::import
5327µs15µs
# spent 5µs within Text::CSV::BEGIN@5 which was called: # once (5µs+0s) by C4::Members::Attributes::BEGIN@23 at line 5
use Carp ();
# spent 5µs making 1 call to Text::CSV::BEGIN@5
6349µs2127µs
# spent 72µs (16+55) within Text::CSV::BEGIN@6 which was called: # once (16µs+55µs) by C4::Members::Attributes::BEGIN@23 at line 6
use vars qw( $VERSION $DEBUG );
# spent 72µs making 1 call to Text::CSV::BEGIN@6 # spent 55µs making 1 call to vars::import
7
8
# spent 6µs within Text::CSV::BEGIN@8 which was called: # once (6µs+0s) by C4::Members::Attributes::BEGIN@23 at line 11
BEGIN {
91600ns $VERSION = '1.18';
1015µs $DEBUG = 0;
111606µs16µs}
# spent 6µ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';
161300nsmy $XS_Version = '0.72';
17
181300nsmy $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
2516µ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#
331800nsmy @UndocumentedXSMethods = qw/Combine Parse SetDiag/;
34
351200nsmy @UndocumentedPPMethods = qw//; # Currently empty
36
37
38# Check the environment variable to decide worker module.
39
401900nsunless ($Text::CSV::Worker) {
411200ns $Text::CSV::DEBUG and Carp::carp("Check used worker module...");
42
4312µ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 {
5812µs13.84ms _load_xs($Install_Dont_Die) or _load_pp();
# spent 3.84ms 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 {
6616µ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;
1363359µs254µs
# spent 33µ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 33µ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.84ms (70µs+3.77) within Text::CSV::_load_xs which was called: # once (70µs+3.77ms) by C4::Members::Attributes::BEGIN@23 at line 58
sub _load_xs {
1461600ns my $opt = shift;
147
1481200ns $Text::CSV::DEBUG and Carp::carp "Load $Module_XS.";
149
150145µs eval qq| use $Module_XS $XS_Version |;
# spent 183µs executing statements in string eval
# includes 3.12ms spent executing 1 call to 1 sub defined therein.
151
1521400ns 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
16018µs push @Text::CSV::ISA, 'Text::CSV_XS';
161
16212µs unless (defined $opt and $opt & $Install_Only) {
16313µs1120µs _set_methods( $Text::CSV::Worker = $Module_XS );
# spent 120µs making 1 call to Text::CSV::_set_methods
164 }
165
16614µs 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 {
19111µs my $class = shift;
192
193 #return;
194
19513µs local $^W;
1963152µs242µs
# spent 26µs (11+15) within Text::CSV::BEGIN@196 which was called: # once (11µs+15µs) by C4::Members::Attributes::BEGIN@23 at line 196
no strict qw(refs);
# spent 26µs making 1 call to Text::CSV::BEGIN@196 # spent 15µs making 1 call to strict::unimport
197
19812µs for my $method (@PublicMethods) {
19937100µs *{"Text::CSV::$method"} = \&{"$class\::$method"};
200 }
201
20212µs if ($Text::CSV::Worker eq $Module_XS) {
203 for my $method (@UndocumentedXSMethods) {
20438µs *{"Text::CSV::$method"} = \&{"$Module_XS\::$method"};
205 }
206 }
207
20816µs if ($Text::CSV::Worker eq $Module_PP) {
209 for my $method (@UndocumentedPPMethods) {
210 *{"Text::CSV::$method"} = \&{"$Module_PP\::$method"};
211 }
212 }
213
214}
215
- -
218126µs1;
219__END__