Profile of DBIx/Class/Relationship/HasMany.pm

← 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/HasMany.pm
Statements | Executed 110 statements in 748µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
24 | 24 | 13 | 329µs | 3.08ms | DBIx::Class::Relationship::HasMany::::has_manyDBIx::Class::Relationship::HasMany::has_many
1 | 1 | 1 | 14µs | 73µs | DBIx::Class::Relationship::HasMany::::BEGIN@6DBIx::Class::Relationship::HasMany::BEGIN@6
1 | 1 | 1 | 12µs | 14µs | DBIx::Class::Relationship::HasMany::::BEGIN@4DBIx::Class::Relationship::HasMany::BEGIN@4
1 | 1 | 1 | 9µs | 202µs | DBIx::Class::Relationship::HasMany::::BEGIN@7DBIx::Class::Relationship::HasMany::BEGIN@7
1 | 1 | 1 | 7µs | 15µs | DBIx::Class::Relationship::HasMany::::BEGIN@5DBIx::Class::Relationship::HasMany::BEGIN@5
0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::HasMany::::__ANON__[:19]DBIx::Class::Relationship::HasMany::__ANON__[:19]
0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::HasMany::::__ANON__[:22]DBIx::Class::Relationship::HasMany::__ANON__[:22]
0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::HasMany::::__ANON__[:44]DBIx::Class::Relationship::HasMany::__ANON__[:44]

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package # hide from PAUSE
2 |  |  |  |  | DBIx::Class::Relationship::HasMany;
3 |  |  |  |  |
4 | 3 | 18µs | 2 | 16µs | # spent 14µs (12+2) within DBIx::Class::Relationship::HasMany::BEGIN@4 which was called: # once (12µs+2µs) by Class::C3::Componentised::ensure_class_loaded at line 4 use strict; # spent 14µs making 1 call to DBIx::Class::Relationship::HasMany::BEGIN@4 # spent 2µs making 1 call to strict::import
5 | 3 | 16µs | 2 | 23µs | # spent 15µs (7+8) within DBIx::Class::Relationship::HasMany::BEGIN@5 which was called: # once (7µs+8µs) by Class::C3::Componentised::ensure_class_loaded at line 5 use warnings; # spent 15µs making 1 call to DBIx::Class::Relationship::HasMany::BEGIN@5 # spent 8µs making 1 call to warnings::import
6 | 3 | 25µs | 2 | 131µs | # spent 73µs (14+58) within DBIx::Class::Relationship::HasMany::BEGIN@6 which was called: # once (14µs+58µs) by Class::C3::Componentised::ensure_class_loaded at line 6 use Try::Tiny; # spent 73µs making 1 call to DBIx::Class::Relationship::HasMany::BEGIN@6 # spent 58µs making 1 call to Exporter::import
7 | 3 | 322µs | 2 | 396µs | # spent 202µs (9+194) within DBIx::Class::Relationship::HasMany::BEGIN@7 which was called: # once (9µs+194µs) by Class::C3::Componentised::ensure_class_loaded at line 7 use namespace::clean; # spent 202µs making 1 call to DBIx::Class::Relationship::HasMany::BEGIN@7 # spent 194µs making 1 call to namespace::clean::import
8 |  |  |  |  |
9 | 1 | 2µs |  |  | our %_pod_inherit_config =
10 |  |  |  |  | (
11 |  |  |  |  | class_map => { 'DBIx::Class::Relationship::HasMany' => 'DBIx::Class::Relationship' }
12 |  |  |  |  | );
13 |  |  |  |  |
14 |  |  |  |  | # spent 3.08ms (329µs+2.75) within DBIx::Class::Relationship::HasMany::has_many which was called 24 times, avg 128µs/call: # once (25µs+161µs) by Class::C3::Componentised::ensure_class_loaded at line 72 of Tapper/Schema/ReportsDB/Result/ReportSection.pm # once (24µs+156µs) by Class::C3::Componentised::ensure_class_loaded at line 26 of Tapper/Schema/ReportsDB/Result/Suite.pm # once (24µs+155µs) by Class::C3::Componentised::ensure_class_loaded at line 35 of Tapper/Schema/ReportsDB/Result/ReportgroupTestrunStats.pm # once (28µs+146µs) by Class::C3::Componentised::ensure_class_loaded at line 27 of Tapper/Schema/TestrunDB/Result/Scenario.pm # once (24µs+149µs) by Class::C3::Componentised::ensure_class_loaded at line 32 of Tapper/Schema/TestrunDB/Result/Queue.pm # once (23µs+150µs) by Class::C3::Componentised::ensure_class_loaded at line 27 of Tapper/Schema/TestrunDB/Result/Precondition.pm # once (24µs+145µs) by Class::C3::Componentised::ensure_class_loaded at line 26 of Tapper/Schema/TestrunDB/Result/TestplanInstance.pm # once (23µs+144µs) by Class::C3::Componentised::ensure_class_loaded at line 28 of Tapper/Schema/ReportsDB/Result/User.pm # once (23µs+140µs) by Class::C3::Componentised::ensure_class_loaded at line 34 of Tapper/Schema/TestrunDB/Result/Host.pm # once (15µs+95µs) by Tapper::MCP::Scheduler::PrioQueue::BEGIN@1 at line 40 of Tapper/Schema/TestrunDB/Result/TestrunScheduling.pm # once (11µs+99µs) by Class::C3::Componentised::ensure_class_loaded at line 43 of Tapper/Schema/TestrunDB/Result/Testrun.pm # once (10µs+96µs) by Class::C3::Componentised::ensure_class_loaded at line 64 of Tapper/Schema/ReportsDB/Result/Report.pm # once (10µs+94µs) by Class::C3::Componentised::ensure_class_loaded at line 31 of Tapper/Schema/TestrunDB/Result/ScenarioElement.pm # once (6µs+94µs) by Class::C3::Componentised::ensure_class_loaded at line 33 of Tapper/Schema/TestrunDB/Result/Queue.pm # once (6µs+95µs) by Class::C3::Componentised::ensure_class_loaded at line 36 of Tapper/Schema/TestrunDB/Result/Host.pm # once (6µs+94µs) by Class::C3::Componentised::ensure_class_loaded at line 29 of Tapper/Schema/ReportsDB/Result/User.pm # once (7µs+93µs) by Class::C3::Componentised::ensure_class_loaded at line 33 of Tapper/Schema/TestrunDB/Result/Precondition.pm # once (6µs+93µs) by Class::C3::Componentised::ensure_class_loaded at line 49 of Tapper/Schema/TestrunDB/Result/Testrun.pm # once (6µs+93µs) by Tapper::MCP::Scheduler::PrioQueue::BEGIN@1 at line 41 of Tapper/Schema/TestrunDB/Result/TestrunScheduling.pm # once (6µs+92µs) by Class::C3::Componentised::ensure_class_loaded at line 30 of Tapper/Schema/TestrunDB/Result/Precondition.pm # once (6µs+92µs) by Class::C3::Componentised::ensure_class_loaded at line 66 of Tapper/Schema/ReportsDB/Result/Report.pm # once (6µs+92µs) by Class::C3::Componentised::ensure_class_loaded at line 35 of Tapper/Schema/TestrunDB/Result/Host.pm # once (5µs+92µs) by Class::C3::Componentised::ensure_class_loaded at line 67 of Tapper/Schema/ReportsDB/Result/Report.pm # once (6µs+92µs) by Class::C3::Componentised::ensure_class_loaded at line 65 of Tapper/Schema/ReportsDB/Result/Report.pm sub has_many {
15 | 24 | 30µs |  |  | my ($class, $rel, $f_class, $cond, $attrs) = @_;
16 |  |  |  |  |
17 | 24 | 13µs |  |  | unless (ref $cond) {
18 |  |  |  |  | $class->ensure_class_loaded($f_class);
19 |  |  |  |  | my ($pri, $too_many) = try { $class->_pri_cols }
20 |  |  |  |  | catch {
21 |  |  |  |  | $class->throw_exception("Can't infer join condition for ${rel} on ${class}: $_");
22 |  |  |  |  | };
23 |  |  |  |  |
24 |  |  |  |  | $class->throw_exception(
25 |  |  |  |  | "has_many can only infer join for a single primary key; ".
26 |  |  |  |  | "${class} has more"
27 |  |  |  |  | ) if $too_many;
28 |  |  |  |  |
29 |  |  |  |  | $class->throw_exception(
30 |  |  |  |  | "has_many needs a primary key to infer a join; ".
31 |  |  |  |  | "${class} has none"
32 |  |  |  |  | ) if !defined $pri && (!defined $cond || !length $cond);
33 |  |  |  |  |
34 |  |  |  |  | my ($f_key,$guess);
35 |  |  |  |  | if (defined $cond && length $cond) {
36 |  |  |  |  | $f_key = $cond;
37 |  |  |  |  | $guess = "caller specified foreign key '$f_key'";
38 |  |  |  |  | } else {
39 |  |  |  |  | $class =~ /([^\:]+)$/;
40 |  |  |  |  | $f_key = lc $1; # go ahead and guess; best we can do
41 |  |  |  |  | $guess = "using our class name '$class' as foreign key";
42 |  |  |  |  | }
43 |  |  |  |  |
44 |  |  |  |  | my $f_class_loaded = try { $f_class->columns };
45 |  |  |  |  | $class->throw_exception(
46 |  |  |  |  | "No such column ${f_key} on foreign class ${f_class} ($guess)"
47 |  |  |  |  | ) if $f_class_loaded && !$f_class->has_column($f_key);
48 |  |  |  |  |
49 |  |  |  |  | $cond = { "foreign.${f_key}" => "self.${pri}" };
50 |  |  |  |  | }
51 |  |  |  |  |
52 | 24 | 19µs |  |  | my $default_cascade = ref $cond eq 'CODE' ? 0 : 1;
53 |  |  |  |  |
54 |  |  |  |  | $class->add_relationship($rel, $f_class, $cond, {
55 |  |  |  |  | accessor => 'multi',
56 |  |  |  |  | join_type => 'LEFT',
57 |  |  |  |  | cascade_delete => $default_cascade,
58 |  |  |  |  | cascade_copy => $default_cascade,
59 | 24 | 294µs | 24 | 2.75ms | %{$attrs||{}} # spent 2.75ms making 24 calls to DBIx::Class::ResultSourceProxy::add_relationship, avg 115µs/call
60 |  |  |  |  | });
61 |  |  |  |  | }
62 |  |  |  |  |
63 | 1 | 9µs | 1 | 211µs | 1; # spent 211µs making 1 call to B::Hooks::EndOfScope::__ANON__[B/Hooks/EndOfScope.pm:26]