← 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:23:48 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/PK.pm
StatementsExecuted 14375 statements in 41.6ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
8451120.8ms128msDBIx::Class::PK::::_mk_ident_condDBIx::Class::PK::_mk_ident_cond
8451117.4ms58.8msDBIx::Class::PK::::_ident_valuesDBIx::Class::PK::_ident_values
845117.45ms135msDBIx::Class::PK::::_storage_ident_conditionDBIx::Class::PK::_storage_ident_condition
11110µs12µsDBIx::Class::PK::::BEGIN@3DBIx::Class::PK::BEGIN@3
1116µs13µsDBIx::Class::PK::::BEGIN@4DBIx::Class::PK::BEGIN@4
1116µs57µsDBIx::Class::PK::::BEGIN@6DBIx::Class::PK::BEGIN@6
0000s0sDBIx::Class::PK::::IDDBIx::Class::PK::ID
0000s0sDBIx::Class::PK::::_create_IDDBIx::Class::PK::_create_ID
0000s0sDBIx::Class::PK::::idDBIx::Class::PK::id
0000s0sDBIx::Class::PK::::ident_conditionDBIx::Class::PK::ident_condition
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::PK;
2
3316µs214µs
# spent 12µs (10+2) within DBIx::Class::PK::BEGIN@3 which was called: # once (10µs+2µs) by Class::C3::Componentised::ensure_class_loaded at line 3
use strict;
# spent 12µs making 1 call to DBIx::Class::PK::BEGIN@3 # spent 2µs making 1 call to strict::import
4318µs221µs
# spent 13µs (6+7) within DBIx::Class::PK::BEGIN@4 which was called: # once (6µs+7µs) by Class::C3::Componentised::ensure_class_loaded at line 4
use warnings;
# spent 13µs making 1 call to DBIx::Class::PK::BEGIN@4 # spent 7µs making 1 call to warnings::import
5
63365µs2109µs
# spent 57µs (6+51) within DBIx::Class::PK::BEGIN@6 which was called: # once (6µs+51µs) by Class::C3::Componentised::ensure_class_loaded at line 6
use base qw/DBIx::Class::Row/;
# spent 57µs making 1 call to DBIx::Class::PK::BEGIN@6 # spent 51µs making 1 call to base::import
7
8=head1 NAME
9
10DBIx::Class::PK - Primary Key class
11
12=head1 SYNOPSIS
13
14=head1 DESCRIPTION
15
16This class contains methods for handling primary keys and methods
17depending on them.
18
19=head1 METHODS
20
21=cut
22
23=head2 id
24
25Returns the primary key(s) for a row. Can't be called as
26a class method.
27
28=cut
29
30sub id {
31 my ($self) = @_;
32 $self->throw_exception( "Can't call id() as a class method" )
33 unless ref $self;
34 my @id_vals = $self->_ident_values;
35 return (wantarray ? @id_vals : $id_vals[0]);
36}
37
38
# spent 58.8ms (17.4+41.4) within DBIx::Class::PK::_ident_values which was called 845 times, avg 70µs/call: # 845 times (17.4ms+41.4ms) by DBIx::Class::PK::_mk_ident_cond at line 117, avg 70µs/call
sub _ident_values {
39845970µs my ($self, $use_storage_state) = @_;
40
41845574µs my (@ids, @missing);
42
438453.29ms84536.4ms for ($self->_pri_cols) {
# spent 36.4ms making 845 calls to DBIx::Class::ResultSourceProxy::_pri_cols, avg 43µs/call
448454.10ms8455.00ms push @ids, ($use_storage_state and exists $self->{_column_data_in_storage}{$_})
# spent 5.00ms making 845 calls to DBIx::Class::Row::get_column, avg 6µs/call
45 ? $self->{_column_data_in_storage}{$_}
46 : $self->get_column($_)
47 ;
488452.10ms push @missing, $_ if (! defined $ids[-1] and ! $self->has_column_loaded ($_) );
49 }
50
51845551µs if (@missing && $self->in_storage) {
52 $self->throw_exception (
53 'Unable to uniquely identify row object with missing PK columns: '
54 . join (', ', @missing )
55 );
56 }
57
588453.71ms return @ids;
59}
60
61=head2 ID
62
63Returns a unique id string identifying a row object by primary key.
64Used by L<DBIx::Class::CDBICompat::LiveObjectIndex> and
65L<DBIx::Class::ObjectCache>.
66
67=over
68
69=item WARNING
70
71The default C<_create_ID> method used by this function orders the returned
72values by the alphabetical order of the primary column names, B<unlike>
73the L</id> method, which follows the same order in which columns were fed
74to L<DBIx::Class::ResultSource/set_primary_key>.
75
76=back
77
78=cut
79
80sub ID {
81 my ($self) = @_;
82 $self->throw_exception( "Can't call ID() as a class method" )
83 unless ref $self;
84 return undef unless $self->in_storage;
85 return $self->_create_ID(%{$self->ident_condition});
86}
87
88sub _create_ID {
89 my ($self, %vals) = @_;
90 return undef unless 0 == grep { !defined } values %vals;
91 return join '|', ref $self || $self, $self->result_source->name,
92 map { $_ . '=' . $vals{$_} } sort keys %vals;
93}
94
95=head2 ident_condition
96
97 my $cond = $result_source->ident_condition();
98
99 my $cond = $result_source->ident_condition('alias');
100
101Produces a condition hash to locate a row based on the primary key(s).
102
103=cut
104
105sub ident_condition {
106 shift->_mk_ident_cond(@_);
107}
108
109
# spent 135ms (7.45+128) within DBIx::Class::PK::_storage_ident_condition which was called 845 times, avg 160µs/call: # 845 times (7.45ms+128ms) by DBIx::Class::Row::update at line 503 of DBIx/Class/Row.pm, avg 160µs/call
sub _storage_ident_condition {
1108455.76ms845128ms shift->_mk_ident_cond(shift, 1);
# spent 128ms making 845 calls to DBIx::Class::PK::_mk_ident_cond, avg 151µs/call
111}
112
113
# spent 128ms (20.8+107) within DBIx::Class::PK::_mk_ident_cond which was called 845 times, avg 151µs/call: # 845 times (20.8ms+107ms) by DBIx::Class::PK::_storage_ident_condition at line 110, avg 151µs/call
sub _mk_ident_cond {
1148451.15ms my ($self, $alias, $use_storage_state) = @_;
115
1168454.12ms84547.9ms my @pks = $self->_pri_cols;
# spent 47.9ms making 845 calls to DBIx::Class::ResultSourceProxy::_pri_cols, avg 57µs/call
1178453.87ms84558.8ms my @vals = $self->_ident_values($use_storage_state);
# spent 58.8ms making 845 calls to DBIx::Class::PK::_ident_values, avg 70µs/call
118
119845602µs my (%cond, @undef);
120845969µs my $prefix = defined $alias ? $alias.'.' : '';
1218451.35ms for my $col (@pks) {
1228452.93ms if (! defined ($cond{$prefix.$col} = shift @vals) ) {
123 push @undef, $col;
124 }
125 }
126
127845513µs if (@undef && $self->in_storage) {
128 $self->throw_exception (
129 'Unable to construct row object identity condition due to NULL PK columns: '
130 . join (', ', @undef)
131 );
132 }
133
1348454.63ms return \%cond;
135}
136
13712µs1;
138
139=head1 AUTHORS
140
141Matt S. Trout <mst@shadowcatsystems.co.uk>
142
143=head1 LICENSE
144
145You may distribute this code under the same terms as Perl itself.
146
147=cut
148