Profile of DBIx/Class/Relationship/ProxyMethods.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/ProxyMethods.pm
Statements | Executed 200 statements in 643µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
60 | 1 | 1 | 409µs | 842µs | DBIx::Class::Relationship::ProxyMethods::::register_relationshipDBIx::Class::Relationship::ProxyMethods::register_relationship
1 | 1 | 1 | 14µs | 16µs | DBIx::Class::Relationship::ProxyMethods::::BEGIN@4DBIx::Class::Relationship::ProxyMethods::BEGIN@4
1 | 1 | 1 | 7µs | 88µs | DBIx::Class::Relationship::ProxyMethods::::BEGIN@7DBIx::Class::Relationship::ProxyMethods::BEGIN@7
1 | 1 | 1 | 7µs | 17µs | DBIx::Class::Relationship::ProxyMethods::::BEGIN@5DBIx::Class::Relationship::ProxyMethods::BEGIN@5
1 | 1 | 1 | 7µs | 18µs | DBIx::Class::Relationship::ProxyMethods::::BEGIN@25DBIx::Class::Relationship::ProxyMethods::BEGIN@25
1 | 1 | 1 | 7µs | 17µs | DBIx::Class::Relationship::ProxyMethods::::BEGIN@26DBIx::Class::Relationship::ProxyMethods::BEGIN@26
1 | 1 | 1 | 4µs | 4µs | DBIx::Class::Relationship::ProxyMethods::::BEGIN@6DBIx::Class::Relationship::ProxyMethods::BEGIN@6
0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::ProxyMethods::::__ANON__[:38]DBIx::Class::Relationship::ProxyMethods::__ANON__[:38]
0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::ProxyMethods::::_build_proxy_map_fromDBIx::Class::Relationship::ProxyMethods::_build_proxy_map_from
0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::ProxyMethods::::proxy_to_relatedDBIx::Class::Relationship::ProxyMethods::proxy_to_related

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::ProxyMethods;
3 |  |  |  |  |
4 | 3 | 19µs | 2 | 18µs | # spent 16µs (14+2) within DBIx::Class::Relationship::ProxyMethods::BEGIN@4 which was called: # once (14µs+2µs) by Class::C3::Componentised::ensure_class_loaded at line 4 use strict; # spent 16µs making 1 call to DBIx::Class::Relationship::ProxyMethods::BEGIN@4 # spent 2µs making 1 call to strict::import
5 | 3 | 22µs | 2 | 26µs | # spent 17µs (7+9) within DBIx::Class::Relationship::ProxyMethods::BEGIN@5 which was called: # once (7µs+9µs) by Class::C3::Componentised::ensure_class_loaded at line 5 use warnings; # spent 17µs making 1 call to DBIx::Class::Relationship::ProxyMethods::BEGIN@5 # spent 10µs making 1 call to warnings::import
6 | 3 | 19µs | 1 | 4µs | # spent 4µs within DBIx::Class::Relationship::ProxyMethods::BEGIN@6 which was called: # once (4µs+0s) by Class::C3::Componentised::ensure_class_loaded at line 6 use Sub::Name (); # spent 4µs making 1 call to DBIx::Class::Relationship::ProxyMethods::BEGIN@6
7 | 3 | 89µs | 2 | 169µs | # spent 88µs (7+81) within DBIx::Class::Relationship::ProxyMethods::BEGIN@7 which was called: # once (7µs+81µs) by Class::C3::Componentised::ensure_class_loaded at line 7 use base qw/DBIx::Class/; # spent 88µs making 1 call to DBIx::Class::Relationship::ProxyMethods::BEGIN@7 # spent 81µs making 1 call to base::import
8 |  |  |  |  |
9 | 1 | 2µs |  |  | our %_pod_inherit_config =
10 |  |  |  |  | (
11 |  |  |  |  | class_map => { 'DBIx::Class::Relationship::ProxyMethods' => 'DBIx::Class::Relationship' }
12 |  |  |  |  | );
13 |  |  |  |  |
14 |  |  |  |  | # spent 842µs (409+433) within DBIx::Class::Relationship::ProxyMethods::register_relationship which was called 60 times, avg 14µs/call: # 60 times (409µs+433µs) by DBIx::Class::Relationship::Accessor::register_relationship at line 28 of mro.pm, avg 14µs/call sub register_relationship {
15 | 60 | 50µs |  |  | my ($class, $rel, $info) = @_;
16 | 60 | 46µs |  |  | if (my $proxy_args = $info->{attrs}{proxy}) {
17 |  |  |  |  | $class->proxy_to_related($rel, $proxy_args);
18 |  |  |  |  | }
19 | 60 | 196µs | 60 | 385µs | $class->next::method($rel, $info); # spent 385µs making 60 calls to next::method, avg 6µs/call
20 |  |  |  |  | }
21 |  |  |  |  |
22 |  |  |  |  | sub proxy_to_related {
23 |  |  |  |  | my ($class, $rel, $proxy_args) = @_;
24 |  |  |  |  | my %proxy_map = $class->_build_proxy_map_from($proxy_args);
25 | 3 | 19µs | 2 | 29µs | # spent 18µs (7+11) within DBIx::Class::Relationship::ProxyMethods::BEGIN@25 which was called: # once (7µs+11µs) by Class::C3::Componentised::ensure_class_loaded at line 25 no strict 'refs'; # spent 18µs making 1 call to DBIx::Class::Relationship::ProxyMethods::BEGIN@25 # spent 11µs making 1 call to strict::unimport
26 | 3 | 180µs | 2 | 27µs | # spent 17µs (7+10) within DBIx::Class::Relationship::ProxyMethods::BEGIN@26 which was called: # once (7µs+10µs) by Class::C3::Componentised::ensure_class_loaded at line 26 no warnings 'redefine'; # spent 17µs making 1 call to DBIx::Class::Relationship::ProxyMethods::BEGIN@26 # spent 10µs making 1 call to warnings::unimport
27 |  |  |  |  | foreach my $meth_name ( keys %proxy_map ) {
28 |  |  |  |  | my $proxy_to_col = $proxy_map{$meth_name};
29 |  |  |  |  | my $name = join '::', $class, $meth_name;
30 |  |  |  |  | *$name = Sub::Name::subname $name => sub {
31 |  |  |  |  | my $self = shift;
32 |  |  |  |  | my $relobj = $self->$rel;
33 |  |  |  |  | if (@_ && !defined $relobj) {
34 |  |  |  |  | $relobj = $self->create_related($rel, { $proxy_to_col => $_[0] });
35 |  |  |  |  | @_ = ();
36 |  |  |  |  | }
37 |  |  |  |  | return ($relobj ? $relobj->$proxy_to_col(@_) : undef);
38 |  |  |  |  | }
39 |  |  |  |  | }
40 |  |  |  |  | }
41 |  |  |  |  |
42 |  |  |  |  | sub _build_proxy_map_from {
43 |  |  |  |  | my ( $class, $proxy_arg ) = @_;
44 |  |  |  |  | my $ref = ref $proxy_arg;
45 |  |  |  |  |
46 |  |  |  |  | if ($ref eq 'HASH') {
47 |  |  |  |  | return %$proxy_arg;
48 |  |  |  |  | }
49 |  |  |  |  | elsif ($ref eq 'ARRAY') {
50 |  |  |  |  | return map {
51 |  |  |  |  | (ref $_ eq 'HASH')
52 |  |  |  |  | ? (%$_)
53 |  |  |  |  | : ($_ => $_)
54 |  |  |  |  | } @$proxy_arg;
55 |  |  |  |  | }
56 |  |  |  |  | elsif ($ref) {
57 |  |  |  |  | $class->throw_exception("Unable to process the 'proxy' argument $proxy_arg");
58 |  |  |  |  | }
59 |  |  |  |  | else {
60 |  |  |  |  | return ( $proxy_arg => $proxy_arg );
61 |  |  |  |  | }
62 |  |  |  |  | }
63 |  |  |  |  |
64 | 1 | 3µs |  |  | 1;