← Index
NYTProf Performance Profile   « line view »
For svc/members/upsert
  Run on Tue Jan 13 11:50:22 2015
Reported on Tue Jan 13 12:09:50 2015

Filename/usr/share/perl5/Text/CSV.pm
StatementsExecuted 87 statements in 1.52ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11186µs86µsText::CSV::::_set_methodsText::CSV::_set_methods
11150µs7.18msText::CSV::::_load_xsText::CSV::_load_xs
11126µs76µsText::CSV::::BEGIN@137Text::CSV::BEGIN@137
11112µs22µsText::CSV::::BEGIN@4Text::CSV::BEGIN@4
11110µs18µsText::CSV::::BEGIN@197Text::CSV::BEGIN@197
1117µs30µsText::CSV::::BEGIN@6Text::CSV::BEGIN@6
1113µs3µsText::CSV::::BEGIN@5Text::CSV::BEGIN@5
1113µs3µsText::CSV::::BEGIN@8Text::CSV::BEGIN@8
1112µs2µ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
4222µs232µs
# spent 22µs (12+10) within Text::CSV::BEGIN@4 which was called: # once (12µs+10µs) by C4::Members::Attributes::BEGIN@23 at line 4
use strict;
# spent 22µs making 1 call to Text::CSV::BEGIN@4 # spent 10µs making 1 call to strict::import
5220µs13µs
# spent 3µs within Text::CSV::BEGIN@5 which was called: # once (3µs+0s) by C4::Members::Attributes::BEGIN@23 at line 5
use Carp ();
# spent 3µs making 1 call to Text::CSV::BEGIN@5
6231µs254µs
# spent 30µs (7+24) within Text::CSV::BEGIN@6 which was called: # once (7µs+24µs) by C4::Members::Attributes::BEGIN@23 at line 6
use vars qw( $VERSION $DEBUG );
# spent 30µs making 1 call to Text::CSV::BEGIN@6 # spent 24µs making 1 call to vars::import
7
8
# spent 3µs within Text::CSV::BEGIN@8 which was called: # once (3µs+0s) by C4::Members::Attributes::BEGIN@23 at line 11
BEGIN {
91300ns $VERSION = '1.32';
1013µs $DEBUG = 0;
111892µs13µs}
# spent 3µs making 1 call to Text::CSV::BEGIN@8
12
13# if use CSV_XS, requires version
141500nsmy $Module_XS = 'Text::CSV_XS';
151200nsmy $Module_PP = 'Text::CSV_PP';
161100nsmy $XS_Version = '0.99';
17
181200nsmy $Is_Dynamic = 0;
19
20# used in _load_xs and _load_pp
211100nsmy $Install_Dont_Die = 1; # When _load_xs fails to load XS, don't die.
221100nsmy $Install_Only = 2; # Don't call _set_methods()
23
24
2513µ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 getline_all getline_hr_all
30 is_missing quote_binary record_number print_hr
31 PV IV NV
32/;
33#
341400nsmy @UndocumentedXSMethods = qw/Combine Parse SetDiag/;
35
361200nsmy @UndocumentedPPMethods = qw//; # Currently empty
37
38
39# Check the environment variable to decide worker module.
40
411500nsunless ($Text::CSV::Worker) {
421100ns $Text::CSV::DEBUG and Carp::carp("Check used worker module...");
43
441900ns if ( exists $ENV{PERL_TEXT_CSV} ) {
45 if ($ENV{PERL_TEXT_CSV} eq '0' or $ENV{PERL_TEXT_CSV} eq 'Text::CSV_PP') {
46 _load_pp();
47 }
48 elsif ($ENV{PERL_TEXT_CSV} eq '1' or $ENV{PERL_TEXT_CSV} =~ /Text::CSV_XS\s*,\s*Text::CSV_PP/) {
49 _load_xs($Install_Dont_Die) or _load_pp();
50 }
51 elsif ($ENV{PERL_TEXT_CSV} eq '2' or $ENV{PERL_TEXT_CSV} eq 'Text::CSV_XS') {
52 _load_xs();
53 }
54 else {
55 Carp::croak "The value of environmental variable 'PERL_TEXT_CSV' is invalid.";
56 }
57 }
58 else {
5912µs17.18ms _load_xs($Install_Dont_Die) or _load_pp();
# spent 7.18ms making 1 call to Text::CSV::_load_xs
60 }
61
62}
63
- -
66
# spent 2µs within Text::CSV::import which was called: # once (2µs+0s) by C4::Members::Attributes::BEGIN@23 at line 23 of C4/Members/Attributes.pm
sub import {
6713µs my ($class, $option) = @_;
68}
69
- -
72sub new { # normal mode
73 my $proto = shift;
74 my $class = ref($proto) || $proto;
75
76 unless ( $proto ) { # for Text::CSV_XS/PP::new(0);
77 return eval qq| $Text::CSV::Worker\::new( \$proto ) |;
78 }
79
80 #if (ref $_[0] and $_[0]->{module}) {
81 # Carp::croak("Can't set 'module' in non dynamic mode.");
82 #}
83
84 if ( my $obj = $Text::CSV::Worker->new(@_) ) {
85 $obj->{_MODULE} = $Text::CSV::Worker;
86 bless $obj, $class;
87 return $obj;
88 }
89 else {
90 return;
91 }
92
93
94}
95
96
97sub require_xs_version { $XS_Version; }
98
99
100sub module {
101 my $proto = shift;
102 return !ref($proto) ? $Text::CSV::Worker
103 : ref($proto->{_MODULE}) ? ref($proto->{_MODULE}) : $proto->{_MODULE};
104}
105
10612µs*backend = *module;
107
108
109sub is_xs {
110 return $_[0]->module eq $Module_XS;
111}
112
113
114sub is_pp {
115 return $_[0]->module eq $Module_PP;
116}
117
118
119sub is_dynamic { $Is_Dynamic; }
120
121
122sub AUTOLOAD {
123 my $self = $_[0];
124 my $attr = $Text::CSV::AUTOLOAD;
125 $attr =~ s/.*:://;
126
127 return if $attr =~ /^[A-Z]+$/;
128 Carp::croak( "Can't locate method $attr" ) unless $attr =~ /^_/;
129
130 my $pkg = $Text::CSV::Worker;
131
132 my $method = "$pkg\::$attr";
133
134 $Text::CSV::DEBUG and Carp::carp("'$attr' is private method, so try to autoload...");
135
136 local $^W;
1372260µs2126µs
# spent 76µs (26+50) within Text::CSV::BEGIN@137 which was called: # once (26µs+50µs) by C4::Members::Attributes::BEGIN@23 at line 137
no strict qw(refs);
# spent 76µs making 1 call to Text::CSV::BEGIN@137 # spent 50µs making 1 call to strict::unimport
138
139 *{"Text::CSV::$attr"} = *{"$pkg\::$attr"};
140
141 goto &$attr;
142}
143
- -
146
# spent 7.18ms (50µs+7.13) within Text::CSV::_load_xs which was called: # once (50µs+7.13ms) by C4::Members::Attributes::BEGIN@23 at line 59
sub _load_xs {
1471200ns my $opt = shift;
148
1491100ns $Text::CSV::DEBUG and Carp::carp "Load $Module_XS.";
150
151127µs eval qq| use $Module_XS $XS_Version |;
# spent 732µs executing statements in string eval
# includes 5.97ms spent executing 1 call to 1 sub defined therein.
152
1531200ns if ($@) {
154 if (defined $opt and $opt & $Install_Dont_Die) {
155 $Text::CSV::DEBUG and Carp::carp "Can't load $Module_XS...($@)";
156 return 0;
157 }
158 Carp::croak $@;
159 }
160
16116µs push @Text::CSV::ISA, 'Text::CSV_XS';
162
16311µs unless (defined $opt and $opt & $Install_Only) {
16412µs186µs _set_methods( $Text::CSV::Worker = $Module_XS );
# spent 86µs making 1 call to Text::CSV::_set_methods
165 }
166
16712µs return 1;
168};
169
170
171sub _load_pp {
172 my $opt = shift;
173
174 $Text::CSV::DEBUG and Carp::carp "Load $Module_PP.";
175
176 eval qq| require $Module_PP |;
177 if ($@) {
178 Carp::croak $@;
179 }
180
181 push @Text::CSV::ISA, 'Text::CSV_PP';
182
183 unless (defined $opt and $opt & $Install_Only) {
184 _set_methods( $Text::CSV::Worker = $Module_PP );
185 }
186};
187
- -
191
# spent 86µs within Text::CSV::_set_methods which was called: # once (86µs+0s) by Text::CSV::_load_xs at line 164
sub _set_methods {
1921400ns my $class = shift;
193
194 #return;
195
19613µs local $^W;
1972129µs226µs
# spent 18µs (10+8) within Text::CSV::BEGIN@197 which was called: # once (10µs+8µs) by C4::Members::Attributes::BEGIN@23 at line 197
no strict qw(refs);
# spent 18µs making 1 call to Text::CSV::BEGIN@197 # spent 8µs making 1 call to strict::unimport
198
1991900ns for my $method (@PublicMethods) {
2004373µs *{"Text::CSV::$method"} = \&{"$class\::$method"};
201 }
202
20311µs if ($Text::CSV::Worker eq $Module_XS) {
204 for my $method (@UndocumentedXSMethods) {
20535µs *{"Text::CSV::$method"} = \&{"$Module_XS\::$method"};
206 }
207 }
208
20915µs if ($Text::CSV::Worker eq $Module_PP) {
210 for my $method (@UndocumentedPPMethods) {
211 *{"Text::CSV::$method"} = \&{"$Module_PP\::$method"};
212 }
213 }
214
215}
216
- -
219118µs1;
220__END__