← Index
NYTProf Performance Profile   « block view • line view • sub view »
For xt/tapper-mcp-scheduler-with-db-longrun.t
  Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:24:07 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Storage/DBI/Cursor.pm
StatementsExecuted 103926 statements in 449ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
427311117ms4.59sDBIx::Class::Storage::DBI::Cursor::::_dbh_nextDBIx::Class::Storage::DBI::Cursor::_dbh_next
46991152.6ms52.6msDBIx::Class::Storage::DBI::Cursor::::newDBIx::Class::Storage::DBI::Cursor::new
42733345.2ms4.92sDBIx::Class::Storage::DBI::Cursor::::nextDBIx::Class::Storage::DBI::Cursor::next
16101139.1ms2.21sDBIx::Class::Storage::DBI::Cursor::::_dbh_allDBIx::Class::Storage::DBI::Cursor::_dbh_all
469922939.1ms91.8msDBIx::Class::Storage::DBI::Cursor::::DESTROYDBIx::Class::Storage::DBI::Cursor::DESTROY
58832119.9ms19.9msDBIx::Class::Storage::DBI::Cursor::::_check_dbh_genDBIx::Class::Storage::DBI::Cursor::_check_dbh_gen
16101119.9ms2.34sDBIx::Class::Storage::DBI::Cursor::::allDBIx::Class::Storage::DBI::Cursor::all
21001112.1ms18.5msDBIx::Class::Storage::DBI::Cursor::::__ANON__[:182]DBIx::Class::Storage::DBI::Cursor::__ANON__[:182]
148111.17ms1.80msDBIx::Class::Storage::DBI::Cursor::::resetDBIx::Class::Storage::DBI::Cursor::reset
14811637µs638µsDBIx::Class::Storage::DBI::Cursor::::_soft_resetDBIx::Class::Storage::DBI::Cursor::_soft_reset
11119µs24µsDBIx::Class::Storage::DBI::Cursor::::BEGIN@3DBIx::Class::Storage::DBI::Cursor::BEGIN@3
11110µs26µsDBIx::Class::Storage::DBI::Cursor::::BEGIN@4DBIx::Class::Storage::DBI::Cursor::BEGIN@4
1119µs60µsDBIx::Class::Storage::DBI::Cursor::::BEGIN@8DBIx::Class::Storage::DBI::Cursor::BEGIN@8
1119µs198µsDBIx::Class::Storage::DBI::Cursor::::BEGIN@9DBIx::Class::Storage::DBI::Cursor::BEGIN@9
1118µs406µsDBIx::Class::Storage::DBI::Cursor::::BEGIN@6DBIx::Class::Storage::DBI::Cursor::BEGIN@6
0000s0sDBIx::Class::Storage::DBI::Cursor::::__ANON__[:156]DBIx::Class::Storage::DBI::Cursor::__ANON__[:156]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package DBIx::Class::Storage::DBI::Cursor;
2
3323µs229µs
# spent 24µs (19+5) within DBIx::Class::Storage::DBI::Cursor::BEGIN@3 which was called: # once (19µs+5µs) by Class::C3::Componentised::ensure_class_loaded at line 3
use strict;
# spent 24µs making 1 call to DBIx::Class::Storage::DBI::Cursor::BEGIN@3 # spent 5µs making 1 call to strict::import
4327µs242µs
# spent 26µs (10+16) within DBIx::Class::Storage::DBI::Cursor::BEGIN@4 which was called: # once (10µs+16µs) by Class::C3::Componentised::ensure_class_loaded at line 4
use warnings;
# spent 26µs making 1 call to DBIx::Class::Storage::DBI::Cursor::BEGIN@4 # spent 16µs making 1 call to warnings::import
5
6322µs2804µs
# spent 406µs (8+398) within DBIx::Class::Storage::DBI::Cursor::BEGIN@6 which was called: # once (8µs+398µs) by Class::C3::Componentised::ensure_class_loaded at line 6
use base qw/DBIx::Class::Cursor/;
# spent 406µs making 1 call to DBIx::Class::Storage::DBI::Cursor::BEGIN@6 # spent 398µs making 1 call to base::import
7
8322µs2110µs
# spent 60µs (9+50) within DBIx::Class::Storage::DBI::Cursor::BEGIN@8 which was called: # once (9µs+50µs) by Class::C3::Componentised::ensure_class_loaded at line 8
use Try::Tiny;
# spent 60µs making 1 call to DBIx::Class::Storage::DBI::Cursor::BEGIN@8 # spent 50µs making 1 call to Exporter::import
93564µs2387µs
# spent 198µs (9+189) within DBIx::Class::Storage::DBI::Cursor::BEGIN@9 which was called: # once (9µs+189µs) by Class::C3::Componentised::ensure_class_loaded at line 9
use namespace::clean;
# spent 198µs making 1 call to DBIx::Class::Storage::DBI::Cursor::BEGIN@9 # spent 189µs making 1 call to namespace::clean::import
10
11115µs1396µs__PACKAGE__->mk_group_accessors('simple' =>
# spent 396µs making 1 call to Class::Accessor::Grouped::mk_group_accessors
12 qw/sth storage args pos attrs _dbh_gen/
13);
14
15=head1 NAME
16
17DBIx::Class::Storage::DBI::Cursor - Object representing a query cursor on a
18resultset.
19
20=head1 SYNOPSIS
21
22 my $cursor = $schema->resultset('CD')->cursor();
23 my $first_cd = $cursor->next;
24
25=head1 DESCRIPTION
26
27A Cursor represents a query cursor on a L<DBIx::Class::ResultSet> object. It
28allows for traversing the result set with L</next>, retrieving all results with
29L</all> and resetting the cursor with L</reset>.
30
31Usually, you would use the cursor methods built into L<DBIx::Class::ResultSet>
32to traverse it. See L<DBIx::Class::ResultSet/next>,
33L<DBIx::Class::ResultSet/reset> and L<DBIx::Class::ResultSet/all> for more
34information.
35
36=head1 METHODS
37
38=head2 new
39
40Returns a new L<DBIx::Class::Storage::DBI::Cursor> object.
41
42=cut
43
44
# spent 52.6ms within DBIx::Class::Storage::DBI::Cursor::new which was called 4699 times, avg 11µs/call: # 4699 times (52.6ms+0s) by DBIx::Class::Storage::DBI::select at line 2213 of DBIx/Class/Storage/DBI.pm, avg 11µs/call
sub new {
4546997.37ms my ($class, $storage, $args, $attrs) = @_;
4646991.43ms $class = ref $class if ref $class;
47
48469925.3ms my $new = {
49 storage => $storage,
50 args => $args,
51 pos => 0,
52 attrs => $attrs,
53 _dbh_gen => $storage->{_dbh_gen},
54 };
55
56469923.4ms return bless ($new, $class);
57}
58
59=head2 next
60
61=over 4
62
63=item Arguments: none
64
65=item Return Value: \@row_columns
66
67=back
68
69Advances the cursor to the next row and returns an array of column
70values (the result of L<DBI/fetchrow_array> method).
71
72=cut
73
74
# spent 4.59s (117ms+4.47) within DBIx::Class::Storage::DBI::Cursor::_dbh_next which was called 4273 times, avg 1.07ms/call: # 4273 times (117ms+4.47s) by DBIx::Class::Storage::DBI::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Storage/DBI.pm:790] at line 789 of DBIx/Class/Storage/DBI.pm, avg 1.07ms/call
sub _dbh_next {
7542734.25ms my ($storage, $dbh, $self) = @_;
76
77427311.3ms427313.9ms $self->_check_dbh_gen;
# spent 13.9ms making 4273 calls to DBIx::Class::Storage::DBI::Cursor::_check_dbh_gen, avg 3µs/call
7842734.94ms if (
79 $self->{attrs}{software_limit}
80 && $self->{attrs}{rows}
81 && $self->{pos} >= $self->{attrs}{rows}
82 ) {
83 $self->sth->finish if $self->sth->{Active};
84 $self->sth(undef);
85 $self->{done} = 1;
86 }
8742732.84ms return if $self->{done};
8842736.53ms2174µs unless ($self->sth) {
# spent 174µs making 2 calls to DBIx::Class::Storage::DBI::Cursor::sth, avg 87µs/call
89308931.8ms30904.42s $self->sth(($storage->_select(@{$self->{args}}))[1]);
# spent 4.42s making 3089 calls to DBIx::Class::Storage::DBI::_select, avg 1.43ms/call # spent 5µs making 1 call to DBIx::Class::Storage::DBI::Cursor::sth
9030874.97ms if ($self->{attrs}{software_limit}) {
91 if (my $offset = $self->{attrs}{offset}) {
92 $self->sth->fetch for 1 .. $offset;
93 }
94 }
95 }
96427163.2ms427239.7ms my @row = $self->sth->fetchrow_array;
# spent 39.7ms making 4271 calls to DBI::st::fetchrow_array, avg 9µs/call # spent 2µs making 1 call to DBIx::Class::Storage::DBI::Cursor::sth
9742714.00ms if (@row) {
98 $self->{pos}++;
99 } else {
100987873µs11µs $self->sth(undef);
# spent 1µs making 1 call to DBIx::Class::Storage::DBI::Cursor::sth
1019871.07ms $self->{done} = 1;
102 }
103427118.7ms return @row;
104}
105
106
# spent 4.92s (45.2ms+4.87) within DBIx::Class::Storage::DBI::Cursor::next which was called 4273 times, avg 1.15ms/call: # 2318 times (21.2ms+2.27s) by DBIx::Class::ResultSet::next at line 1209 of DBIx/Class/ResultSet.pm, avg 990µs/call # 1954 times (23.9ms+2.60s) by DBIx::Class::ResultSetColumn::next at line 161 of DBIx/Class/ResultSetColumn.pm, avg 1.34ms/call # once (10µs+2.23ms) by DBIx::Class::Schema::Versioned::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Schema/Versioned.pm:752] at line 750 of DBIx/Class/Schema/Versioned.pm
sub next {
10742732.87ms my ($self) = @_;
108427348.8ms85464.87s $self->{storage}->dbh_do($self->can('_dbh_next'), $self);
# spent 4.87s making 4273 calls to DBIx::Class::Storage::DBI::dbh_do, avg 1.14ms/call # spent 8.08ms making 4273 calls to UNIVERSAL::can, avg 2µs/call
109}
110
111=head2 all
112
113=over 4
114
115=item Arguments: none
116
117=item Return Value: \@row_columns+
118
119=back
120
121Returns a list of arrayrefs of column values for all rows in the
122L<DBIx::Class::ResultSet>.
123
124=cut
125
126
# spent 2.21s (39.1ms+2.17) within DBIx::Class::Storage::DBI::Cursor::_dbh_all which was called 1610 times, avg 1.37ms/call: # 1610 times (39.1ms+2.17s) by DBIx::Class::Storage::DBI::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Storage/DBI.pm:790] at line 789 of DBIx/Class/Storage/DBI.pm, avg 1.37ms/call
sub _dbh_all {
12716101.82ms my ($storage, $dbh, $self) = @_;
128
12916104.35ms16106.05ms $self->_check_dbh_gen;
# spent 6.05ms making 1610 calls to DBIx::Class::Storage::DBI::Cursor::_check_dbh_gen, avg 4µs/call
13016102.50ms11µs $self->sth->finish if $self->sth && $self->sth->{Active};
# spent 1µs making 1 call to DBIx::Class::Storage::DBI::Cursor::sth
13116101.97ms11µs $self->sth(undef);
# spent 1µs making 1 call to DBIx::Class::Storage::DBI::Cursor::sth
132161013.1ms16102.13s my ($rv, $sth) = $storage->_select(@{$self->{args}});
# spent 2.13s making 1610 calls to DBIx::Class::Storage::DBI::_select, avg 1.33ms/call
133161040.8ms161026.7ms return @{$sth->fetchall_arrayref};
# spent 26.7ms making 1610 calls to DBI::st::fetchall_arrayref, avg 17µs/call
134}
135
136
# spent 2.34s (19.9ms+2.32) within DBIx::Class::Storage::DBI::Cursor::all which was called 1610 times, avg 1.46ms/call: # 1610 times (19.9ms+2.32s) by DBIx::Class::ResultSet::all at line 1651 of DBIx/Class/ResultSet.pm, avg 1.46ms/call
sub all {
13716101.44ms my ($self) = @_;
13816102.13ms if ($self->{attrs}{software_limit}
139 && ($self->{attrs}{offset} || $self->{attrs}{rows})) {
140 return $self->next::method;
141 }
142
143161020.7ms32202.32s $self->{storage}->dbh_do($self->can('_dbh_all'), $self);
# spent 2.32s making 1610 calls to DBIx::Class::Storage::DBI::dbh_do, avg 1.44ms/call # spent 4.09ms making 1610 calls to UNIVERSAL::can, avg 3µs/call
144}
145
146=head2 reset
147
148Resets the cursor to the beginning of the L<DBIx::Class::ResultSet>.
149
150=cut
151
152
# spent 1.80ms (1.17+639µs) within DBIx::Class::Storage::DBI::Cursor::reset which was called 148 times, avg 12µs/call: # 148 times (1.17ms+639µs) by DBIx::Class::ResultSet::reset at line 1679 of DBIx/Class/ResultSet.pm, avg 12µs/call
sub reset {
15314890µs my ($self) = @_;
154
155 # No need to care about failures here
156 try { $self->sth->finish }
157148252µs11µs if $self->sth && $self->sth->{Active};
# spent 1µs making 1 call to DBIx::Class::Storage::DBI::Cursor::sth
158148326µs148638µs $self->_soft_reset;
# spent 638µs making 148 calls to DBIx::Class::Storage::DBI::Cursor::_soft_reset, avg 4µs/call
159148316µs return undef;
160}
161
162
# spent 638µs (637+700ns) within DBIx::Class::Storage::DBI::Cursor::_soft_reset which was called 148 times, avg 4µs/call: # 148 times (637µs+700ns) by DBIx::Class::Storage::DBI::Cursor::reset at line 158, avg 4µs/call
sub _soft_reset {
16314886µs my ($self) = @_;
164
165148192µs1700ns $self->sth(undef);
# spent 700ns making 1 call to DBIx::Class::Storage::DBI::Cursor::sth
16614882µs delete $self->{done};
167148487µs $self->{pos} = 0;
168}
169
170
# spent 19.9ms within DBIx::Class::Storage::DBI::Cursor::_check_dbh_gen which was called 5883 times, avg 3µs/call: # 4273 times (13.9ms+0s) by DBIx::Class::Storage::DBI::Cursor::_dbh_next at line 77, avg 3µs/call # 1610 times (6.05ms+0s) by DBIx::Class::Storage::DBI::Cursor::_dbh_all at line 129, avg 4µs/call
sub _check_dbh_gen {
17158833.10ms my ($self) = @_;
172
173588325.4ms if($self->{_dbh_gen} != $self->{storage}->{_dbh_gen}) {
174 $self->{_dbh_gen} = $self->{storage}->{_dbh_gen};
175 $self->_soft_reset;
176 }
177}
178
179
# spent 91.8ms (39.1+52.7) within DBIx::Class::Storage::DBI::Cursor::DESTROY which was called 4699 times, avg 20µs/call: # 845 times (7.30ms+11.4ms) by DBIx::Class::ResultSet::count or Tapper::Schema::TestrunDB::Result::TestrunScheduling::fits at line 179 of Tapper/Schema/TestrunDB/Result/TestrunScheduling.pm, avg 22µs/call # 594 times (7.06ms+13.8ms) by DBIx::Class::ResultSet::count at line 154 of Tapper/Schema/TestrunDB/Result/TestrunScheduling.pm, avg 35µs/call # 477 times (1.91ms+0s) by Tapper::Schema::TestrunDB::Result::Queue::get_first_fitting at line 95 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 4µs/call # 477 times (1.83ms+0s) by Tapper::MCP::Scheduler::PrioQueue::get_first_fitting at line 90 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 4µs/call # 402 times (3.17ms+4.65ms) by DBIx::Class::ResultSet::count or Tapper::MCP::Scheduler::Controller::toggle_bandwith_color at line 44 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 19µs/call # 331 times (1.77ms+0s) by DBIx::Class::ResultSet::search at line 512 of DBIx/Class/Relationship/Base.pm, avg 5µs/call # 330 times (4.01ms+7.86ms) by DBIx::Class::ResultSet::count at line 42 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 36µs/call # 180 times (1.10ms+0s) by main::toggle_host_free at line 56 of xt/tapper-mcp-scheduler-with-db-longrun.t, avg 6µs/call # 180 times (481µs+0s) by Tapper::MCP::Scheduler::Controller::get_next_job at line 84 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 3µs/call # 180 times (445µs+0s) by Tapper::Model::free_hosts_with_features at line 78 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 2µs/call # 147 times (3.41ms+6.61ms) by DBIx::Class::ResultSet::count at line 162 of Tapper/Schema/TestrunDB/Result/Testrun.pm, avg 68µs/call # 147 times (2.01ms+3.90ms) by DBIx::Class::ResultSet::count at line 168 of Tapper/Schema/TestrunDB/Result/Testrun.pm, avg 40µs/call # 147 times (1.66ms+3.48ms) by Tapper::Schema::TestrunDB::Result::Testrun::rerun at line 133 of Tapper/Schema/TestrunDB/Result/Testrun.pm, avg 35µs/call # 147 times (1.77ms+0s) by Tapper::Schema::TestrunDB::Result::Testrun::rerun at line 96 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 12µs/call # 72 times (606µs+0s) by Tapper::MCP::Scheduler::Controller::get_next_job at line 117 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 8µs/call # 34 times (444µs+864µs) by DBIx::Class::ResultSet::count at line 57 of xt/tapper-mcp-scheduler-with-db-longrun.t, avg 38µs/call # 3 times (57µs+129µs) by Try::Tiny::try at line 79 of Try/Tiny.pm, avg 62µs/call # 2 times (14µs+2µs) by Try::Tiny::try at line 84 of Try/Tiny.pm, avg 8µs/call # once (9µs+35µs) by Tapper::Model::model at line 53 of Tapper/Model.pm # once (4µs+0s) by Tapper::Schema::TestrunDB::Result::TestrunScheduling::gen_schema_functions at line 51 of Tapper/Model.pm # once (3µs+0s) by DBIx::Class::Schema::Versioned::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Schema/Versioned.pm:752] at line 751 of DBIx/Class/Schema/Versioned.pm # once (3µs+0s) by Moose::Meta::Attribute::initialize_instance_slot at line 521 of Moose/Meta/Attribute.pm
sub DESTROY {
180 # None of the reasons this would die matter if we're in DESTROY anyways
181469942.8ms420152.6ms if (my $sth = $_[0]->sth) {
# spent 48.9ms making 2100 calls to Try::Tiny::try, avg 23µs/call, recursion: max depth 1, sum of overlapping time 111µs # spent 3.81ms making 2100 calls to DBI::common::FETCH, avg 2µs/call # spent 2µs making 1 call to DBIx::Class::Storage::DBI::Cursor::sth
182210022.7ms21006.41ms
# spent 18.5ms (12.1+6.41) within DBIx::Class::Storage::DBI::Cursor::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Storage/DBI/Cursor.pm:182] which was called 2100 times, avg 9µs/call: # 2100 times (12.1ms+6.41ms) by Try::Tiny::try at line 76 of Try/Tiny.pm, avg 9µs/call
try { $sth->finish } if $sth->FETCH('Active');
# spent 6.41ms making 2100 calls to DBI::st::finish, avg 3µs/call
183 }
184}
185
186112µs1214µs1;