← 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:00 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Relationship/HasOne.pm
StatementsExecuted 136 statements in 836µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
711121µs389µsDBIx::Class::Relationship::HasOne::::_validate_has_one_conditionDBIx::Class::Relationship::HasOne::_validate_has_one_condition
711113µs1.24msDBIx::Class::Relationship::HasOne::::_has_oneDBIx::Class::Relationship::HasOne::_has_one
77340µs1.28msDBIx::Class::Relationship::HasOne::::might_haveDBIx::Class::Relationship::HasOne::might_have
71114µs14µsDBIx::Class::Relationship::HasOne::::CORE:matchDBIx::Class::Relationship::HasOne::CORE:match (opcode)
11113µs15µsDBIx::Class::Relationship::HasOne::::BEGIN@4DBIx::Class::Relationship::HasOne::BEGIN@4
1118µs17µsDBIx::Class::Relationship::HasOne::::BEGIN@5DBIx::Class::Relationship::HasOne::BEGIN@5
1118µs98µsDBIx::Class::Relationship::HasOne::::BEGIN@6DBIx::Class::Relationship::HasOne::BEGIN@6
1117µs160µsDBIx::Class::Relationship::HasOne::::BEGIN@8DBIx::Class::Relationship::HasOne::BEGIN@8
1117µs46µsDBIx::Class::Relationship::HasOne::::BEGIN@7DBIx::Class::Relationship::HasOne::BEGIN@7
0000s0sDBIx::Class::Relationship::HasOne::::__ANON__[:35]DBIx::Class::Relationship::HasOne::__ANON__[:35]
0000s0sDBIx::Class::Relationship::HasOne::::__ANON__[:69]DBIx::Class::Relationship::HasOne::__ANON__[:69]
0000s0sDBIx::Class::Relationship::HasOne::::__ANON__[:72]DBIx::Class::Relationship::HasOne::__ANON__[:72]
0000s0sDBIx::Class::Relationship::HasOne::::_get_primary_keyDBIx::Class::Relationship::HasOne::_get_primary_key
0000s0sDBIx::Class::Relationship::HasOne::::has_oneDBIx::Class::Relationship::HasOne::has_one
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package # hide from PAUSE
2 DBIx::Class::Relationship::HasOne;
3
4319µs218µs
# spent 15µs (13+3) within DBIx::Class::Relationship::HasOne::BEGIN@4 which was called: # once (13µs+3µs) by Class::C3::Componentised::ensure_class_loaded at line 4
use strict;
# spent 15µs making 1 call to DBIx::Class::Relationship::HasOne::BEGIN@4 # spent 2µs making 1 call to strict::import
5317µs227µs
# spent 17µs (8+10) within DBIx::Class::Relationship::HasOne::BEGIN@5 which was called: # once (8µs+10µs) by Class::C3::Componentised::ensure_class_loaded at line 5
use warnings;
# spent 17µs making 1 call to DBIx::Class::Relationship::HasOne::BEGIN@5 # spent 10µs making 1 call to warnings::import
6320µs2189µs
# spent 98µs (8+91) within DBIx::Class::Relationship::HasOne::BEGIN@6 which was called: # once (8µs+91µs) by Class::C3::Componentised::ensure_class_loaded at line 6
use DBIx::Class::Carp;
# spent 98µs making 1 call to DBIx::Class::Relationship::HasOne::BEGIN@6 # spent 91µs making 1 call to DBIx::Class::Carp::import
7318µs286µs
# spent 46µs (7+40) within DBIx::Class::Relationship::HasOne::BEGIN@7 which was called: # once (7µs+40µs) by Class::C3::Componentised::ensure_class_loaded at line 7
use Try::Tiny;
# spent 46µs making 1 call to DBIx::Class::Relationship::HasOne::BEGIN@7 # spent 40µs making 1 call to Exporter::import
83468µs2313µs
# spent 160µs (7+153) within DBIx::Class::Relationship::HasOne::BEGIN@8 which was called: # once (7µs+153µs) by Class::C3::Componentised::ensure_class_loaded at line 8
use namespace::clean;
# spent 160µs making 1 call to DBIx::Class::Relationship::HasOne::BEGIN@8 # spent 153µs making 1 call to namespace::clean::import
9
1012µsour %_pod_inherit_config =
11 (
12 class_map => { 'DBIx::Class::Relationship::HasOne' => 'DBIx::Class::Relationship' }
13 );
14
15
# spent 1.28ms (40µs+1.24) within DBIx::Class::Relationship::HasOne::might_have which was called 7 times, avg 183µs/call: # once (9µs+289µs) by Class::C3::Componentised::ensure_class_loaded at line 27 of Tapper/Schema/ReportsDB/Result/ReportgroupTestrun.pm # once (10µs+172µs) by Class::C3::Componentised::ensure_class_loaded at line 46 of Tapper/Schema/TestrunDB/Result/Testrun.pm # once (11µs+170µs) by Class::C3::Componentised::ensure_class_loaded at line 60 of Tapper/Schema/ReportsDB/Result/Report.pm # once (2µs+173µs) by Class::C3::Componentised::ensure_class_loaded at line 48 of Tapper/Schema/TestrunDB/Result/Testrun.pm # once (3µs+147µs) by Class::C3::Componentised::ensure_class_loaded at line 47 of Tapper/Schema/TestrunDB/Result/Testrun.pm # once (3µs+147µs) by Class::C3::Componentised::ensure_class_loaded at line 61 of Tapper/Schema/ReportsDB/Result/Report.pm # once (2µs+146µs) by Class::C3::Componentised::ensure_class_loaded at line 62 of Tapper/Schema/ReportsDB/Result/Report.pm
sub might_have {
16747µs71.24ms shift->_has_one('LEFT' => @_);
# spent 1.24ms making 7 calls to DBIx::Class::Relationship::HasOne::_has_one, avg 178µs/call
17}
18
19sub has_one {
20 shift->_has_one(undef() => @_);
21}
22
23
# spent 1.24ms (113µs+1.13) within DBIx::Class::Relationship::HasOne::_has_one which was called 7 times, avg 178µs/call: # 7 times (113µs+1.13ms) by DBIx::Class::Relationship::HasOne::might_have at line 16, avg 178µs/call
sub _has_one {
2442105µs my ($class, $join_type, $rel, $f_class, $cond, $attrs) = @_;
25 unless (ref $cond) {
26 $class->ensure_class_loaded($f_class);
27
28 my $pri = $class->_get_primary_key;
29
30 $class->throw_exception(
31 "might_have/has_one needs a primary key to infer a join; ".
32 "${class} has none"
33 ) if !defined $pri && (!defined $cond || !length $cond);
34
35 my $f_class_loaded = try { $f_class->columns };
36 my ($f_key,$too_many,$guess);
37 if (defined $cond && length $cond) {
38 $f_key = $cond;
39 $guess = "caller specified foreign key '$f_key'";
40 } elsif ($f_class_loaded && $f_class->has_column($rel)) {
41 $f_key = $rel;
42 $guess = "using given relationship '$rel' for foreign key";
43 } else {
44 $f_key = $class->_get_primary_key($f_class);
45 $guess = "using primary key of foreign class for foreign key";
46 }
47 $class->throw_exception(
48 "No such column ${f_key} on foreign class ${f_class} ($guess)"
49 ) if $f_class_loaded && !$f_class->has_column($f_key);
50 $cond = { "foreign.${f_key}" => "self.${pri}" };
51 }
527389µs $class->_validate_has_one_condition($cond);
# spent 389µs making 7 calls to DBIx::Class::Relationship::HasOne::_validate_has_one_condition, avg 56µs/call
53
54 my $default_cascade = ref $cond eq 'CODE' ? 0 : 1;
55
56 $class->add_relationship($rel, $f_class,
57 $cond,
58 { accessor => 'single',
59 cascade_update => $default_cascade,
60 cascade_delete => $default_cascade,
61 ($join_type ? ('join_type' => $join_type) : ()),
627742µs %{$attrs || {}} });
# spent 742µs making 7 calls to DBIx::Class::ResultSourceProxy::add_relationship, avg 106µs/call
63 1;
64}
65
66sub _get_primary_key {
67 my ( $class, $target_class ) = @_;
68 $target_class ||= $class;
69 my ($pri, $too_many) = try { $target_class->_pri_cols }
70 catch {
71 $class->throw_exception("Can't infer join condition on ${target_class}: $_");
72 };
73
74 $class->throw_exception(
75 "might_have/has_one can only infer join for a single primary key; ".
76 "${class} has more"
77 ) if $too_many;
78 return $pri;
79}
80
81
# spent 389µs (121+268) within DBIx::Class::Relationship::HasOne::_validate_has_one_condition which was called 7 times, avg 56µs/call: # 7 times (121µs+268µs) by DBIx::Class::Relationship::HasOne::_has_one at line 52, avg 56µs/call
sub _validate_has_one_condition {
822835µs my ($class, $cond ) = @_;
83
84 return if $ENV{DBIC_DONT_VALIDATE_RELS};
85 return unless 'HASH' eq ref $cond;
86 foreach my $foreign_id ( keys %$cond ) {
874294µs my $self_id = $cond->{$foreign_id};
88
89 # we can ignore a bad $self_id because add_relationship handles this
90 # warning
91714µs return unless $self_id =~ /^self\.(.*)$/;
# spent 14µs making 7 calls to DBIx::Class::Relationship::HasOne::CORE:match, avg 2µs/call
92 my $key = $1;
937120µs $class->throw_exception("Defining rel on ${class} that includes ${key} but no such column defined here yet")
# spent 120µs making 7 calls to DBIx::Class::ResultSourceProxy::has_column, avg 17µs/call
94 unless $class->has_column($key);
957134µs my $column_info = $class->column_info($key);
# spent 134µs making 7 calls to DBIx::Class::ResultSourceProxy::column_info, avg 19µs/call
96 if ( $column_info->{is_nullable} ) {
97 carp(qq'"might_have/has_one" must not be on columns with is_nullable set to true ($class/$key). This might indicate an incorrect use of those relationship helpers instead of belongs_to.');
98 }
99 }
100}
101
102111µs1410µs1;
 
# spent 14µs within DBIx::Class::Relationship::HasOne::CORE:match which was called 7 times, avg 2µs/call: # 7 times (14µs+0s) by DBIx::Class::Relationship::HasOne::_validate_has_one_condition at line 91, avg 2µs/call
sub DBIx::Class::Relationship::HasOne::CORE:match; # opcode