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

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Relationship/BelongsTo.pm
StatementsExecuted 478 statements in 1.81ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2929201.23ms6.04msDBIx::Class::Relationship::BelongsTo::::belongs_toDBIx::Class::Relationship::BelongsTo::belongs_to
5821119µs119µsDBIx::Class::Relationship::BelongsTo::::CORE:matchDBIx::Class::Relationship::BelongsTo::CORE:match (opcode)
11115µs17µsDBIx::Class::Relationship::BelongsTo::::BEGIN@7DBIx::Class::Relationship::BelongsTo::BEGIN@7
1118µs137µsDBIx::Class::Relationship::BelongsTo::::BEGIN@10DBIx::Class::Relationship::BelongsTo::BEGIN@10
1117µs19µsDBIx::Class::Relationship::BelongsTo::::BEGIN@8DBIx::Class::Relationship::BelongsTo::BEGIN@8
1117µs41µsDBIx::Class::Relationship::BelongsTo::::BEGIN@9DBIx::Class::Relationship::BelongsTo::BEGIN@9
0000s0sDBIx::Class::Relationship::BelongsTo::::__ANON__[:29]DBIx::Class::Relationship::BelongsTo::__ANON__[:29]
0000s0sDBIx::Class::Relationship::BelongsTo::::__ANON__[:32]DBIx::Class::Relationship::BelongsTo::__ANON__[:32]
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::BelongsTo;
3
4# Documentation for these methods can be found in
5# DBIx::Class::Relationship
6
7320µs219µs
# spent 17µs (15+2) within DBIx::Class::Relationship::BelongsTo::BEGIN@7 which was called: # once (15µs+2µs) by Class::C3::Componentised::ensure_class_loaded at line 7
use strict;
# spent 17µs making 1 call to DBIx::Class::Relationship::BelongsTo::BEGIN@7 # spent 2µs making 1 call to strict::import
8318µs230µs
# spent 19µs (7+11) within DBIx::Class::Relationship::BelongsTo::BEGIN@8 which was called: # once (7µs+11µs) by Class::C3::Componentised::ensure_class_loaded at line 8
use warnings;
# spent 19µs making 1 call to DBIx::Class::Relationship::BelongsTo::BEGIN@8 # spent 11µs making 1 call to warnings::import
9319µs275µs
# spent 41µs (7+34) within DBIx::Class::Relationship::BelongsTo::BEGIN@9 which was called: # once (7µs+34µs) by Class::C3::Componentised::ensure_class_loaded at line 9
use Try::Tiny;
# spent 41µs making 1 call to DBIx::Class::Relationship::BelongsTo::BEGIN@9 # spent 34µs making 1 call to Exporter::import
103378µs2266µs
# spent 137µs (8+129) within DBIx::Class::Relationship::BelongsTo::BEGIN@10 which was called: # once (8µs+129µs) by Class::C3::Componentised::ensure_class_loaded at line 10
use namespace::clean;
# spent 137µs making 1 call to DBIx::Class::Relationship::BelongsTo::BEGIN@10 # spent 129µs making 1 call to namespace::clean::import
11
1212µsour %_pod_inherit_config =
13 (
14 class_map => { 'DBIx::Class::Relationship::BelongsTo' => 'DBIx::Class::Relationship' }
15 );
16
17
# spent 6.04ms (1.23+4.81) within DBIx::Class::Relationship::BelongsTo::belongs_to which was called 29 times, avg 208µs/call: # once (58µs+323µs) by Tapper::MCP::Scheduler::PrioQueue::BEGIN@1 at line 36 of Tapper/Schema/TestrunDB/Result/TestrunScheduling.pm # once (59µs+200µs) by Class::C3::Componentised::ensure_class_loaded at line 26 of Tapper/Schema/ReportsDB/Result/ReportTopic.pm # once (49µs+205µs) by Class::C3::Componentised::ensure_class_loaded at line 36 of Tapper/Schema/ReportsDB/Result/Tap.pm # once (53µs+195µs) by Class::C3::Componentised::ensure_class_loaded at line 35 of Tapper/Schema/ReportsDB/Result/ReportFile.pm # once (59µs+188µs) by Class::C3::Componentised::ensure_class_loaded at line 26 of Tapper/Schema/ReportsDB/Result/ReportgroupArbitrary.pm # once (61µs+186µs) by Class::C3::Componentised::ensure_class_loaded at line 29 of Tapper/Schema/TestrunDB/Result/ScenarioElement.pm # once (51µs+194µs) by Class::C3::Componentised::ensure_class_loaded at line 59 of Tapper/Schema/ReportsDB/Result/Report.pm # once (58µs+186µs) by Class::C3::Componentised::ensure_class_loaded at line 27 of Tapper/Schema/TestrunDB/Result/TestrunRequestedHost.pm # once (58µs+183µs) by Class::C3::Componentised::ensure_class_loaded at line 25 of Tapper/Schema/TestrunDB/Result/TestrunPrecondition.pm # once (57µs+182µs) by Class::C3::Componentised::ensure_class_loaded at line 25 of Tapper/Schema/TestrunDB/Result/PrePrecondition.pm # once (56µs+179µs) by Class::C3::Componentised::ensure_class_loaded at line 25 of Tapper/Schema/TestrunDB/Result/TestrunRequestedFeature.pm # once (57µs+178µs) by Class::C3::Componentised::ensure_class_loaded at line 27 of Tapper/Schema/TestrunDB/Result/QueueHost.pm # once (50µs+184µs) by Class::C3::Componentised::ensure_class_loaded at line 31 of Tapper/Schema/ReportsDB/Result/Notification.pm # once (50µs+181µs) by Class::C3::Componentised::ensure_class_loaded at line 29 of Tapper/Schema/ReportsDB/Result/ReportComment.pm # once (48µs+183µs) by Class::C3::Componentised::ensure_class_loaded at line 30 of Tapper/Schema/ReportsDB/Result/Contact.pm # once (48µs+181µs) by Class::C3::Componentised::ensure_class_loaded at line 40 of Tapper/Schema/TestrunDB/Result/Testrun.pm # once (49µs+176µs) by Class::C3::Componentised::ensure_class_loaded at line 34 of Tapper/Schema/TestrunDB/Result/State.pm # once (48µs+176µs) by Class::C3::Componentised::ensure_class_loaded at line 33 of Tapper/Schema/TestrunDB/Result/HostFeature.pm # once (48µs+176µs) by Class::C3::Componentised::ensure_class_loaded at line 33 of Tapper/Schema/TestrunDB/Result/Message.pm # once (19µs+142µs) by Class::C3::Componentised::ensure_class_loaded at line 30 of Tapper/Schema/ReportsDB/Result/ReportComment.pm # once (31µs+109µs) by Class::C3::Componentised::ensure_class_loaded at line 28 of Tapper/Schema/ReportsDB/Result/ReportgroupTestrun.pm # once (23µs+114µs) by Class::C3::Componentised::ensure_class_loaded at line 26 of Tapper/Schema/TestrunDB/Result/TestrunPrecondition.pm # once (20µs+117µs) by Tapper::MCP::Scheduler::PrioQueue::BEGIN@1 at line 37 of Tapper/Schema/TestrunDB/Result/TestrunScheduling.pm # once (19µs+117µs) by Class::C3::Componentised::ensure_class_loaded at line 30 of Tapper/Schema/TestrunDB/Result/ScenarioElement.pm # once (19µs+113µs) by Class::C3::Componentised::ensure_class_loaded at line 28 of Tapper/Schema/TestrunDB/Result/QueueHost.pm # once (20µs+112µs) by Class::C3::Componentised::ensure_class_loaded at line 28 of Tapper/Schema/TestrunDB/Result/TestrunRequestedHost.pm # once (22µs+109µs) by Class::C3::Componentised::ensure_class_loaded at line 26 of Tapper/Schema/TestrunDB/Result/PrePrecondition.pm # once (20µs+108µs) by Class::C3::Componentised::ensure_class_loaded at line 41 of Tapper/Schema/TestrunDB/Result/Testrun.pm # once (19µs+106µs) by Tapper::MCP::Scheduler::PrioQueue::BEGIN@1 at line 38 of Tapper/Schema/TestrunDB/Result/TestrunScheduling.pm
sub belongs_to {
182940µs my ($class, $rel, $f_class, $cond, $attrs) = @_;
19
20 # assume a foreign key contraint unless defined otherwise
212943µs $attrs->{is_foreign_key_constraint} = 1
22 if not exists $attrs->{is_foreign_key_constraint};
232928µs $attrs->{undef_on_null_fk} = 1
24 if not exists $attrs->{undef_on_null_fk};
25
26 # no join condition or just a column name
272941µs if (!ref $cond) {
28 $class->ensure_class_loaded($f_class);
29 my %f_primaries = map { $_ => 1 } try { $f_class->_pri_cols }
30 catch {
31 $class->throw_exception( "Can't infer join condition for ${rel} on ${class}: $_");
32 };
33
34 my ($pri, $too_many) = keys %f_primaries;
35 $class->throw_exception(
36 "Can't infer join condition for ${rel} on ${class}; ".
37 "${f_class} has multiple primary keys"
38 ) if $too_many;
39
40 my $fk = defined $cond ? $cond : $rel;
41 $class->throw_exception(
42 "Can't infer join condition for ${rel} on ${class}; ".
43 "$fk is not a column of $class"
44 ) unless $class->has_column($fk);
45
46 $cond = { "foreign.${pri}" => "self.${fk}" };
47
48 }
49 # explicit join condition
50 elsif (ref $cond) {
512931µs if (ref $cond eq 'HASH') { # ARRAY is also valid
52296µs my $cond_rel;
532931µs for (keys %$cond) {
5429112µs2933µs if (m/\./) { # Explicit join condition
# spent 33µs making 29 calls to DBIx::Class::Relationship::BelongsTo::CORE:match, avg 1µs/call
55297µs $cond_rel = $cond;
562933µs last;
57 }
58 $cond_rel->{"foreign.$_"} = "self.".$cond->{$_};
59 }
602911µs $cond = $cond_rel;
61 }
62 }
63 # dunno
64 else {
65 $class->throw_exception(
66 'third argument for belongs_to must be undef, a column name, '.
67 'or a join condition'
68 );
69 }
70
7129185µs29511µs my $acc_type = (
# spent 511µs making 29 calls to DBIx::Class::ResultSourceProxy::has_column, avg 18µs/call
72 ref $cond eq 'HASH'
73 and
74 keys %$cond == 1
75 and
76 $class->has_column($rel)
77 ) ? 'filter' : 'single';
78
7929209µs2986µs my $fk_columns = ($acc_type eq 'single' and ref $cond eq 'HASH')
# spent 86µs making 29 calls to DBIx::Class::Relationship::BelongsTo::CORE:match, avg 3µs/call
802983µs ? { map { $_ =~ /^self\.(.+)/ ? ( $1 => 1 ) : () } (values %$cond ) }
81 : undef
82 ;
83
84 $class->add_relationship($rel, $f_class,
85 $cond,
86 {
87 accessor => $acc_type,
88 $fk_columns ? ( fk_columns => $fk_columns ) : (),
8929372µs294.18ms %{$attrs || {}}
# spent 4.18ms making 29 calls to DBIx::Class::ResultSourceProxy::add_relationship, avg 144µs/call
90 }
91 );
92
9329135µs return 1;
94}
95
96# Attempt to remove the POD so it (maybe) falls off the indexer
97
98#=head1 AUTHORS
99#
100#Alexander Hartmaier <Alexander.Hartmaier@t-systems.at>
101#
102#Matt S. Trout <mst@shadowcatsystems.co.uk>
103#
104#=cut
105
10618µs1186µs1;
 
# spent 119µs within DBIx::Class::Relationship::BelongsTo::CORE:match which was called 58 times, avg 2µs/call: # 29 times (86µs+0s) by DBIx::Class::Relationship::BelongsTo::belongs_to at line 79, avg 3µs/call # 29 times (33µs+0s) by DBIx::Class::Relationship::BelongsTo::belongs_to at line 54, avg 1µs/call
sub DBIx::Class::Relationship::BelongsTo::CORE:match; # opcode