← Index
NYTProf Performance Profile   « line view »
For split.pl
  Run on Thu Apr 20 02:05:47 2023
Reported on Thu Apr 20 18:31:09 2023

Filename/home/hejohns/perl5/lib/perl5/Text/CSV.pm
StatementsExecuted 44 statements in 533µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11155µs6.56msText::CSV::::_loadText::CSV::_load
1118µs10µsText::CSV::::BEGIN@4Text::CSV::BEGIN@4
1116µs10µsText::CSV::::BEGIN@122Text::CSV::BEGIN@122
1114µs29µsText::CSV::::BEGIN@7Text::CSV::BEGIN@7
1114µs9µsText::CSV::::BEGIN@5Text::CSV::BEGIN@5
1112µs6.57msText::CSV::::_load_xsText::CSV::_load_xs
1112µs2µsText::CSV::::BEGIN@11Text::CSV::BEGIN@11
1111µs1µsText::CSV::::BEGIN@6Text::CSV::BEGIN@6
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
4218µs211µs
# spent 10µs (8+2) within Text::CSV::BEGIN@4 which was called: # once (8µs+2µs) by main::BEGIN@20 at line 4
use strict;
# spent 10µs making 1 call to Text::CSV::BEGIN@4 # spent 2µs making 1 call to strict::import
5212µs214µs
# spent 9µs (4+5) within Text::CSV::BEGIN@5 which was called: # once (4µs+5µs) by main::BEGIN@20 at line 5
use Exporter;
# spent 9µs making 1 call to Text::CSV::BEGIN@5 # spent 5µs making 1 call to Exporter::import
6213µs11µs
# spent 1µs within Text::CSV::BEGIN@6 which was called: # once (1µs+0s) by main::BEGIN@20 at line 6
use Carp ();
# spent 1µs making 1 call to Text::CSV::BEGIN@6
7232µs254µs
# spent 29µs (4+25) within Text::CSV::BEGIN@7 which was called: # once (4µs+25µs) by main::BEGIN@20 at line 7
use vars qw( $VERSION $DEBUG @ISA @EXPORT_OK );
# spent 29µs making 1 call to Text::CSV::BEGIN@7 # spent 25µs making 1 call to vars::import
816µs@ISA = qw( Exporter );
91300ns@EXPORT_OK = qw( csv );
10
11
# spent 2µs within Text::CSV::BEGIN@11 which was called: # once (2µs+0s) by main::BEGIN@20 at line 14
BEGIN {
121300ns $VERSION = '2.01';
1312µs $DEBUG = 0;
141304µs12µs}
# spent 2µs making 1 call to Text::CSV::BEGIN@11
15
16# if use CSV_XS, requires version
171200nsmy $Module_XS = 'Text::CSV_XS';
181100nsmy $Module_PP = 'Text::CSV_PP';
191100nsmy $XS_Version = '1.46';
20
211100nsmy $Is_Dynamic = 0;
22
231600nsmy @PublicMethods = qw/
24 version error_diag error_input
25 known_attributes csv
26 PV IV NV
27/;
28#
29
30# Check the environment variable to decide worker module.
31
321300nsunless ($Text::CSV::Worker) {
331100ns $Text::CSV::DEBUG and Carp::carp("Check used worker module...");
34
351500ns if ( exists $ENV{PERL_TEXT_CSV} ) {
36 if ($ENV{PERL_TEXT_CSV} eq '0' or $ENV{PERL_TEXT_CSV} eq 'Text::CSV_PP') {
37 _load_pp() or Carp::croak $@;
38 }
39 elsif ($ENV{PERL_TEXT_CSV} eq '1' or $ENV{PERL_TEXT_CSV} =~ /Text::CSV_XS\s*,\s*Text::CSV_PP/) {
40 _load_xs() or _load_pp() or Carp::croak $@;
41 }
42 elsif ($ENV{PERL_TEXT_CSV} eq '2' or $ENV{PERL_TEXT_CSV} eq 'Text::CSV_XS') {
43 _load_xs() or Carp::croak $@;
44 }
45 else {
46 Carp::croak "The value of environmental variable 'PERL_TEXT_CSV' is invalid.";
47 }
48 }
49 else {
501900ns16.57ms _load_xs() or _load_pp() or Carp::croak $@;
# spent 6.57ms making 1 call to Text::CSV::_load_xs
51 }
52
53}
54
55sub new { # normal mode
56 my $proto = shift;
57 my $class = ref($proto) || $proto;
58
59 unless ( $proto ) { # for Text::CSV_XS/PP::new(0);
60 return eval qq| $Text::CSV::Worker\::new( \$proto ) |;
61 }
62
63 #if (ref $_[0] and $_[0]->{module}) {
64 # Carp::croak("Can't set 'module' in non dynamic mode.");
65 #}
66
67 if ( my $obj = $Text::CSV::Worker->new(@_) ) {
68 $obj->{_MODULE} = $Text::CSV::Worker;
69 bless $obj, $class;
70 return $obj;
71 }
72 else {
73 return;
74 }
75
76
77}
78
79
80sub require_xs_version { $XS_Version; }
81
82
83sub module {
84 my $proto = shift;
85 return !ref($proto) ? $Text::CSV::Worker
86 : ref($proto->{_MODULE}) ? ref($proto->{_MODULE}) : $proto->{_MODULE};
87}
88
8911µs*backend = *module;
90
91
92sub is_xs {
93 return $_[0]->module eq $Module_XS;
94}
95
96
97sub is_pp {
98 return $_[0]->module eq $Module_PP;
99}
100
101
102sub is_dynamic { $Is_Dynamic; }
103
10412µs16.56ms
# spent 6.57ms (2µs+6.56) within Text::CSV::_load_xs which was called: # once (2µs+6.56ms) by main::BEGIN@20 at line 50
sub _load_xs { _load($Module_XS, $XS_Version) }
# spent 6.56ms making 1 call to Text::CSV::_load
105
106sub _load_pp { _load($Module_PP) }
107
108
# spent 6.56ms (55µs+6.51) within Text::CSV::_load which was called: # once (55µs+6.51ms) by Text::CSV::_load_xs at line 104
sub _load {
1091300ns my ($module, $version) = @_;
1101200ns $version ||= '';
111
11210s $Text::CSV::DEBUG and Carp::carp "Load $module.";
113
114127µs eval qq| use $module $version |;
# spent 85µs executing statements in string eval
# includes 6.21ms spent executing 1 call to 1 sub defined therein.
115
1161100ns return if $@;
117
11816µs push @Text::CSV::ISA, $module;
1191300ns $Text::CSV::Worker = $module;
120
12111µs local $^W;
122276µs215µs
# spent 10µs (6+5) within Text::CSV::BEGIN@122 which was called: # once (6µs+5µs) by main::BEGIN@20 at line 122
no strict qw(refs);
# spent 10µs making 1 call to Text::CSV::BEGIN@122 # spent 5µs making 1 call to strict::unimport
123
1241500ns for my $method (@PublicMethods) {
125811µs *{"Text::CSV::$method"} = \&{"$module\::$method"};
126 }
12712µs return 1;
128}
129
- -
132115µs1;
133__END__