← Index
Performance Profile   « block view • line view • sub view »
For /wise/base/deliv/dev/bin/getfix
  Run on Thu May 20 15:30:03 2010
Reported on Thu May 20 16:25:28 2010

File/wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Storage/DBI/Cursor.pm
Statements Executed665809
Total Time76.8240949996862 seconds

Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
55479111.20293559.82232DBIx::Class::Storage::DBI::Cursor::_dbh_next
55479210.45418565.71995DBIx::Class::Storage::DBI::Cursor::next
55479110.304030.30403DBIx::Class::Storage::DBI::Cursor::_check_dbh_gen
4118.3e-58.3e-5DBIx::Class::Storage::DBI::Cursor::new
1111.3e-52.2e-5DBIx::Class::Storage::DBI::Cursor::reset
1119.0e-69.0e-6DBIx::Class::Storage::DBI::Cursor::_soft_reset
00000DBIx::Class::Storage::DBI::Cursor::BEGIN
00000DBIx::Class::Storage::DBI::Cursor::DESTROY
00000DBIx::Class::Storage::DBI::Cursor::_dbh_all
00000DBIx::Class::Storage::DBI::Cursor::all

LineStmts.Exclusive
Time
Avg.Code
1package DBIx::Class::Storage::DBI::Cursor;
2
333.2e-51.1e-5use base qw/DBIx::Class::Cursor/;
# spent 1.03ms making 1 call to base::import
4
534.9e-51.6e-5use strict;
# spent 39µs making 1 call to strict::import
630.000640.00021use warnings;
# spent 19µs making 1 call to warnings::import
7
8=head1 NAME
9
10DBIx::Class::Storage::DBI::Cursor - Object representing a query cursor on a
11resultset.
12
13=head1 SYNOPSIS
14
15 my $cursor = $schema->resultset('CD')->cursor();
16 my $first_cd = $cursor->next;
17
18=head1 DESCRIPTION
19
20A Cursor represents a query cursor on a L<DBIx::Class::ResultSet> object. It
21allows for traversing the result set with L</next>, retrieving all results with
22L</all> and resetting the cursor with L</reset>.
23
24Usually, you would use the cursor methods built into L<DBIx::Class::ResultSet>
25to traverse it. See L<DBIx::Class::ResultSet/next>,
26L<DBIx::Class::ResultSet/reset> and L<DBIx::Class::ResultSet/all> for more
27information.
28
29=head1 METHODS
30
31=head2 new
32
33Returns a new L<DBIx::Class::Storage::DBI::Cursor> object.
34
35=cut
36
37
# spent 83µs within DBIx::Class::Storage::DBI::Cursor::new which was called 4 times, avg 21µs/call: # 4 times (83µs+0) by DBIx::Class::Storage::DBI::select at line 1160 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Storage/DBI.pm, avg 21µs/call
sub new {
38166.6e-54.1e-6 my ($class, $storage, $args, $attrs) = @_;
39 #use Data::Dumper; warn Dumper(@_);
40 $class = ref $class if ref $class;
41 my $new = {
42 storage => $storage,
43 args => $args,
44 pos => 0,
45 attrs => $attrs,
46 _dbh_gen => $storage->{_dbh_gen},
47 };
48
49 return bless ($new, $class);
50}
51
52=head2 next
53
54=over 4
55
56=item Arguments: none
57
58=item Return Value: \@row_columns
59
60=back
61
62Advances the cursor to the next row and returns an array of column
63values (the result of L<DBI/fetchrow_array> method).
64
65=cut
66
67
# spent 560s (1.20+559) within DBIx::Class::Storage::DBI::Cursor::_dbh_next which was called 55479 times, avg 10.1ms/call: # 55479 times (1.20s+559s) by DBIx::Class::Storage::DBI::dbh_do at line 593 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Storage/DBI.pm, avg 10.1ms/call
sub _dbh_next {
6844384276.049090.00017 my ($storage, $dbh, $self) = @_;
69
70 $self->_check_dbh_gen;
# spent 304ms making 55479 calls to DBIx::Class::Storage::DBI::Cursor::_check_dbh_gen, avg 5µs/call
71 if ($self->{attrs}{rows} && $self->{pos} >= $self->{attrs}{rows}) {
72 $self->{sth}->finish if $self->{sth}->{Active};
73 delete $self->{sth};
74 $self->{done} = 1;
75 }
76 return if $self->{done};
77 unless ($self->{sth}) {
78 $self->{sth} = ($storage->_select(@{$self->{args}}))[1];
# spent 483s making 4 calls to DBIx::Class::Storage::DBI::MultiDistinctEmulation::_select, avg 121s/call
79 if ($self->{attrs}{software_limit}) {
80 if (my $offset = $self->{attrs}{offset}) {
81 $self->{sth}->fetch for 1 .. $offset;
82 }
83 }
84 }
85 my @row = $self->{sth}->fetchrow_array;
# spent 74.9s making 55479 calls to DBI::st::fetchrow_array, avg 1.35ms/call
86 if (@row) {
87 $self->{pos}++;
88 } else {
89 delete $self->{sth};
90 $self->{done} = 1;
91 }
92 return @row;
93}
94
95
# spent 566s (454ms+565) within DBIx::Class::Storage::DBI::Cursor::next which was called 55479 times, avg 10.2ms/call: # 55477 times (454ms+183s) by DBIx::Class::ResultSet::next at line 758 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/ResultSet.pm, avg 3.30ms/call # 2 times (23µs+383s) by DBIx::Class::ResultSet::_count at line 995 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/ResultSet.pm, avg 191s/call
sub next {
961109580.586835.3e-6 my ($self) = @_;
97 $self->{storage}->dbh_do($self->can('_dbh_next'), $self);
# spent 565s making 55479 calls to DBIx::Class::Storage::DBI::dbh_do, avg 10.2ms/call # spent 178ms making 55479 calls to UNIVERSAL::can, avg 3µs/call
98}
99
100=head2 all
101
102=over 4
103
104=item Arguments: none
105
106=item Return Value: \@row_columns+
107
108=back
109
110Returns a list of arrayrefs of column values for all rows in the
111L<DBIx::Class::ResultSet>.
112
113=cut
114
115sub _dbh_all {
116 my ($storage, $dbh, $self) = @_;
117
118 $self->_check_dbh_gen;
119 $self->{sth}->finish if $self->{sth}->{Active};
120 delete $self->{sth};
121 my ($rv, $sth) = $storage->_select(@{$self->{args}});
122 return @{$sth->fetchall_arrayref};
123}
124
125sub all {
126 my ($self) = @_;
127 if ($self->{attrs}{software_limit}
128 && ($self->{attrs}{offset} || $self->{attrs}{rows})) {
129 return $self->SUPER::all;
130 }
131 $self->{storage}->dbh_do($self->can('_dbh_all'), $self);
132}
133
134=head2 reset
135
136Resets the cursor to the beginning of the L<DBIx::Class::ResultSet>.
137
138=cut
139
140
# spent 22µs (13+9) within DBIx::Class::Storage::DBI::Cursor::reset which was called # once (13µs+9µs) by DBIx::Class::ResultSet::reset at line 1077 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/ResultSet.pm
sub reset {
14141.3e-53.3e-6 my ($self) = @_;
142
143 # No need to care about failures here
144 eval { $self->{sth}->finish if $self->{sth} && $self->{sth}->{Active} };
145 $self->_soft_reset;
# spent 9µs making 1 call to DBIx::Class::Storage::DBI::Cursor::_soft_reset
146}
147
148
# spent 9µs within DBIx::Class::Storage::DBI::Cursor::_soft_reset which was called # once (9µs+0) by DBIx::Class::Storage::DBI::Cursor::reset at line 145
sub _soft_reset {
14954.0e-68.0e-7 my ($self) = @_;
150
151 delete $self->{sth};
152 delete $self->{done};
153 $self->{pos} = 0;
154 return $self;
155}
156
157
# spent 304ms within DBIx::Class::Storage::DBI::Cursor::_check_dbh_gen which was called 55479 times, avg 5µs/call: # 55479 times (304ms+0) by DBIx::Class::Storage::DBI::Cursor::_dbh_next at line 70, avg 5µs/call
sub _check_dbh_gen {
1581109580.187071.7e-6 my ($self) = @_;
159
160 if($self->{_dbh_gen} != $self->{storage}->{_dbh_gen}) {
161 $self->{_dbh_gen} = $self->{storage}->{_dbh_gen};
162 $self->_soft_reset;
163 }
164}
165
166sub DESTROY {
167160.000291.8e-5 my ($self) = @_;
168
169 # None of the reasons this would die matter if we're in DESTROY anyways
170 local $@;
171 eval { $self->{sth}->finish if $self->{sth} && $self->{sth}->{Active} };
# spent 132µs making 3 calls to DBI::st::finish, avg 44µs/call # spent 66µs making 3 calls to DBI::common::FETCH, avg 22µs/call
172}
173
17413.0e-63.0e-61;