← Index
NYTProf Performance Profile   « line view »
For starman worker -M FindBin --max-requests 50 --workers 2 --user=kohadev-koha --group kohadev-koha --pid /var/run/koha/kohadev/plack.pid --daemonize --access-log /var/log/koha/kohadev/plack.log --error-log /var/log/koha/kohadev/plack-error.log -E deployment --socket /var/run/koha/kohadev/plack.sock /etc/koha/sites/kohadev/plack.psgi
  Run on Fri Jan 8 14:31:06 2016
Reported on Fri Jan 8 14:31:37 2016

Filename/usr/share/perl5/DBIx/Class/Relationship/HasOne.pm
StatementsExecuted 199 statements in 1.67ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111399µs870µsDBIx::Class::Relationship::HasOne::::_validate_has_one_conditionDBIx::Class::Relationship::HasOne::_validate_has_one_condition
1111198µs2.66msDBIx::Class::Relationship::HasOne::::_has_oneDBIx::Class::Relationship::HasOne::_has_one
1111670µs2.73msDBIx::Class::Relationship::HasOne::::might_haveDBIx::Class::Relationship::HasOne::might_have
111149µs49µsDBIx::Class::Relationship::HasOne::::CORE:matchDBIx::Class::Relationship::HasOne::CORE:match (opcode)
11115µs24µsDBIx::Class::Relationship::HasOne::::BEGIN@4DBIx::Class::Relationship::HasOne::BEGIN@4
11110µs56µsDBIx::Class::Relationship::HasOne::::BEGIN@6DBIx::Class::Relationship::HasOne::BEGIN@6
1119µs39µsDBIx::Class::Relationship::HasOne::::BEGIN@7DBIx::Class::Relationship::HasOne::BEGIN@7
1118µs14µsDBIx::Class::Relationship::HasOne::::BEGIN@5DBIx::Class::Relationship::HasOne::BEGIN@5
1117µs118µsDBIx::Class::Relationship::HasOne::::BEGIN@8DBIx::Class::Relationship::HasOne::BEGIN@8
0000s0sDBIx::Class::Relationship::HasOne::::__ANON__[:42]DBIx::Class::Relationship::HasOne::__ANON__[:42]
0000s0sDBIx::Class::Relationship::HasOne::::__ANON__[:48]DBIx::Class::Relationship::HasOne::__ANON__[:48]
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
4239µs234µs
# spent 24µs (15+10) within DBIx::Class::Relationship::HasOne::BEGIN@4 which was called: # once (15µs+10µs) by Class::C3::Componentised::ensure_class_loaded at line 4
use strict;
# spent 24µs making 1 call to DBIx::Class::Relationship::HasOne::BEGIN@4 # spent 10µs making 1 call to strict::import
5230µs219µs
# spent 14µs (8+5) within DBIx::Class::Relationship::HasOne::BEGIN@5 which was called: # once (8µs+5µs) by Class::C3::Componentised::ensure_class_loaded at line 5
use warnings;
# spent 14µs making 1 call to DBIx::Class::Relationship::HasOne::BEGIN@5 # spent 5µs making 1 call to warnings::import
6227µs2101µs
# spent 56µs (10+46) within DBIx::Class::Relationship::HasOne::BEGIN@6 which was called: # once (10µs+46µs) by Class::C3::Componentised::ensure_class_loaded at line 6
use DBIx::Class::Carp;
# spent 56µs making 1 call to DBIx::Class::Relationship::HasOne::BEGIN@6 # spent 46µs making 1 call to DBIx::Class::Carp::import
7259µs270µs
# spent 39µs (9+31) within DBIx::Class::Relationship::HasOne::BEGIN@7 which was called: # once (9µs+31µs) by Class::C3::Componentised::ensure_class_loaded at line 7
use Try::Tiny;
# spent 39µs making 1 call to DBIx::Class::Relationship::HasOne::BEGIN@7 # spent 31µs making 1 call to Exporter::import
82781µs2228µs
# spent 118µs (7+110) within DBIx::Class::Relationship::HasOne::BEGIN@8 which was called: # once (7µs+110µs) by Class::C3::Componentised::ensure_class_loaded at line 8
use namespace::clean;
# spent 118µs making 1 call to DBIx::Class::Relationship::HasOne::BEGIN@8 # spent 110µ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 2.73ms (70µs+2.66) within DBIx::Class::Relationship::HasOne::might_have which was called 11 times, avg 249µs/call: # once (11µs+440µs) by Class::C3::Componentised::ensure_class_loaded at line 248 of Koha/Schema/Result/Category.pm # once (13µs+380µs) by Class::C3::Componentised::ensure_class_loaded at line 160 of Koha/Schema/Result/Itemtype.pm # once (8µs+263µs) by Class::C3::Componentised::ensure_class_loaded at line 466 of Koha/Schema/Result/Item.pm # once (7µs+232µs) by Class::C3::Componentised::ensure_class_loaded at line 393 of Koha/Schema/Result/Branch.pm # once (5µs+232µs) by Class::C3::Componentised::ensure_class_loaded at line 551 of Koha/Schema/Result/Item.pm # once (8µs+223µs) by Class::C3::Componentised::ensure_class_loaded at line 367 of Koha/Schema/Result/Aqorder.pm # once (8µs+211µs) by Class::C3::Componentised::ensure_class_loaded at line 981 of Koha/Schema/Result/Borrower.pm # once (3µs+188µs) by Class::C3::Componentised::ensure_class_loaded at line 626 of Koha/Schema/Result/Item.pm # once (2µs+176µs) by Class::C3::Componentised::ensure_class_loaded at line 496 of Koha/Schema/Result/Item.pm # once (2µs+162µs) by Class::C3::Componentised::ensure_class_loaded at line 382 of Koha/Schema/Result/Aqorder.pm # once (2µs+157µs) by Class::C3::Componentised::ensure_class_loaded at line 566 of Koha/Schema/Result/Item.pm
sub might_have {
161184µs112.66ms shift->_has_one('LEFT' => @_);
# spent 2.66ms making 11 calls to DBIx::Class::Relationship::HasOne::_has_one, avg 242µs/call
17}
18
19sub has_one {
20 shift->_has_one(undef() => @_);
21}
22
23
# spent 2.66ms (198µs+2.47) within DBIx::Class::Relationship::HasOne::_has_one which was called 11 times, avg 242µs/call: # 11 times (198µs+2.47ms) by DBIx::Class::Relationship::HasOne::might_have at line 16, avg 242µs/call
sub _has_one {
24119µs my ($class, $join_type, $rel, $f_class, $cond, $attrs) = @_;
25116µs unless (ref $cond) {
26 my $pri = $class->result_source_instance->_single_pri_col_or_die;
27
28 my ($f_key,$guess,$f_rsrc);
29 if (defined $cond && length $cond) {
30 $f_key = $cond;
31 $guess = "caller specified foreign key '$f_key'";
32 }
33 else {
34 # at this point we need to load the foreigner, expensive or not
35 $class->ensure_class_loaded($f_class);
36
37 $f_rsrc = try {
38 my $r = $f_class->result_source_instance;
39 die "There got to be some columns by now... (exception caught and rewritten by catch below)"
40 unless $r->columns;
41 $r;
42 }
43 catch {
44 $class->throw_exception(
45 "Foreign class '$f_class' does not seem to be a Result class "
46 . "(or it simply did not load entirely due to a circular relation chain)"
47 );
48 };
49
50 if ($f_rsrc->has_column($rel)) {
51 $f_key = $rel;
52 $guess = "using given relationship name '$rel' as foreign key column name";
53 }
54 else {
55 $f_key = $f_rsrc->_single_pri_col_or_die;
56 $guess = "using primary key of foreign class for foreign key";
57 }
58 }
59
60# FIXME - this check needs to be moved to schema-composition time...
61# # only perform checks if the far side was not preloaded above *AND*
62# # appears to have been loaded by something else (has a rsrc_instance)
63# if (! $f_rsrc and $f_rsrc = try { $f_class->result_source_instance }) {
64# $class->throw_exception(
65# "No such column '$f_key' on foreign class ${f_class} ($guess)"
66# ) if !$f_rsrc->has_column($f_key);
67# }
68
69 $cond = { "foreign.${f_key}" => "self.${pri}" };
70 }
711159µs11870µs $class->_validate_has_one_condition($cond);
# spent 870µs making 11 calls to DBIx::Class::Relationship::HasOne::_validate_has_one_condition, avg 79µs/call
72
731110µs my $default_cascade = ref $cond eq 'CODE' ? 0 : 1;
74
75 $class->add_relationship($rel, $f_class,
76 $cond,
77 { accessor => 'single',
78 cascade_update => $default_cascade,
79 cascade_delete => $default_cascade,
80 is_depends_on => 0,
81 ($join_type ? ('join_type' => $join_type) : ()),
821169µs111.60ms %{$attrs || {}} });
# spent 1.60ms making 11 calls to DBIx::Class::ResultSourceProxy::add_relationship, avg 145µs/call
831128µs 1;
84}
85
86
# spent 870µs (399+471) within DBIx::Class::Relationship::HasOne::_validate_has_one_condition which was called 11 times, avg 79µs/call: # 11 times (399µs+471µs) by DBIx::Class::Relationship::HasOne::_has_one at line 71, avg 79µs/call
sub _validate_has_one_condition {
871111µs my ($class, $cond ) = @_;
88
891112µs return if $ENV{DBIC_DONT_VALIDATE_RELS};
90119µs return unless 'HASH' eq ref $cond;
911144µs foreach my $foreign_id ( keys %$cond ) {
92116µs my $self_id = $cond->{$foreign_id};
93
94 # we can ignore a bad $self_id because add_relationship handles this
95 # exception
961186µs1149µs return unless $self_id =~ /^self\.(.*)$/;
# spent 49µs making 11 calls to DBIx::Class::Relationship::HasOne::CORE:match, avg 4µs/call
97
981121µs my $key = $1;
9911155µs11241µs $class->throw_exception("Defining rel on ${class} that includes '$key' but no such column defined here yet")
# spent 241µs making 11 calls to DBIx::Class::ResultSourceProxy::has_column, avg 22µs/call
100 unless $class->has_column($key);
10111101µs11181µs my $column_info = $class->column_info($key);
# spent 181µs making 11 calls to DBIx::Class::ResultSourceProxy::column_info, avg 16µs/call
1021118µs if ( $column_info->{is_nullable} ) {
103 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.');
104 }
105 }
106}
107
10813µs1148µs1;
# spent 148µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__
 
# spent 49µs within DBIx::Class::Relationship::HasOne::CORE:match which was called 11 times, avg 4µs/call: # 11 times (49µs+0s) by DBIx::Class::Relationship::HasOne::_validate_has_one_condition at line 96, avg 4µs/call
sub DBIx::Class::Relationship::HasOne::CORE:match; # opcode