← Index
NYTProf Performance Profile   « line view »
For script/ponapi
  Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:11 2016

Filename/home/mickey/git_tree/PONAPI/Server/lib/PONAPI/Builder/Links.pm
StatementsExecuted 9452068 statements in 16.2s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
10916153316.2s25.2sPONAPI::Builder::Links::::buildPONAPI::Builder::Links::build
716014334.03s15.2sPONAPI::Builder::Links::::add_linkPONAPI::Builder::Links::add_link
52902421685ms685msPONAPI::Builder::Links::::__ANON__[lib/PONAPI/Builder/Links.pm:15]PONAPI::Builder::Links::__ANON__[lib/PONAPI/Builder/Links.pm:15]
11116µs6.70msPONAPI::Builder::Links::::BEGIN@4PONAPI::Builder::Links::BEGIN@4
1119µs72µsPONAPI::Builder::Links::::BEGIN@52PONAPI::Builder::Links::BEGIN@52
0000s0sPONAPI::Builder::Links::::add_linksPONAPI::Builder::Links::add_links
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# ABSTRACT: document builder - links
2package PONAPI::Builder::Links;
3
42237µs213.4ms
# spent 6.70ms (16µs+6.69) within PONAPI::Builder::Links::BEGIN@4 which was called: # once (16µs+6.69ms) by PONAPI::Builder::Role::HasLinksBuilder::BEGIN@6 at line 4
use Moose;
# spent 6.70ms making 1 call to PONAPI::Builder::Links::BEGIN@4 # spent 6.69ms making 1 call to Moose::import
5
613µs17.65mswith 'PONAPI::Builder',
# spent 7.65ms making 1 call to Moose::with
7 'PONAPI::Builder::Role::HasMeta';
8
9has _links => (
10 init_arg => undef,
11 traits => [ 'Hash' ],
12 is => 'ro',
13 isa => 'HashRef',
14 lazy => 1,
155290242.75s
# spent 685ms within PONAPI::Builder::Links::__ANON__[lib/PONAPI/Builder/Links.pm:15] which was called 529024 times, avg 1µs/call: # 429023 times (594ms+0s) by PONAPI::Builder::Links::_add_link at line 24 of (eval 45)[Eval/Closure.pm:144], avg 1µs/call # 100001 times (90.5ms+0s) by PONAPI::Builder::Links::has_link at line 20 of (eval 45)[Eval/Closure.pm:144], avg 905ns/call
default => sub { +{} },
16110µs1103ms handles => {
# spent 103ms making 1 call to Moose::has
17 'has_links' => 'count',
18 'has_link' => 'exists',
19 'get_link' => 'get',
20 # private ...
21 '_add_link' => 'set',
22 '_keys_links' => 'keys',
23 }
24);
25
26
# spent 15.2s (4.03+11.2) within PONAPI::Builder::Links::add_link which was called 716014 times, avg 21µs/call: # 345766 times (1.85s+4.73s) by PONAPI::Builder::Relationship::_add_relationship_link at line 63 of lib/PONAPI/Builder/Relationship.pm, avg 19µs/call # 270247 times (1.64s+5.59s) by PONAPI::Builder::Resource::add_self_link at line 95 of lib/PONAPI/Builder/Resource.pm, avg 27µs/call # 100001 times (537ms+867ms) by PONAPI::Builder::Document::add_self_link at line 138 of lib/PONAPI/Builder/Document.pm, avg 14µs/call
sub add_link {
27716014350ms my ( $self, $rel, $url ) = @_;
287160141.01s71601411.2s $self->_add_link( $rel => $url );
# spent 11.2s making 716014 calls to PONAPI::Builder::Links::_add_link, avg 16µs/call
297160142.49s return $self;
30}
31
32sub add_links {
33 my ( $self, %links ) = @_;
34 $self->add_link( $_, $links{ $_ } ) foreach keys %links;
35 return $self;
36}
37
38
# spent 25.2s (16.2+9.07) within PONAPI::Builder::Links::build which was called 1091615 times, avg 23µs/call: # 607534 times (8.68s+5.13s) by PONAPI::Builder::Resource::build at line 106 of lib/PONAPI/Builder/Resource.pm, avg 23µs/call # 384080 times (5.89s+2.96s) by PONAPI::Builder::Relationship::build at line 89 of lib/PONAPI/Builder/Relationship.pm, avg 23µs/call # 100001 times (1.59s+984ms) by PONAPI::Builder::Document::build at line 149 of lib/PONAPI/Builder/Document.pm, avg 26µs/call
sub build {
391091615218ms my $self = $_[0];
401091615313ms my $result = {};
41
4210916151.73s10916152.76s foreach my $key ( $self->_keys_links ) {
# spent 2.76s making 1091615 calls to PONAPI::Builder::Links::_keys_links, avg 3µs/call
4313169192.68s13169194.40s $result->{ $key } = $self->get_link( $key );
# spent 4.40s making 1316919 calls to PONAPI::Builder::Links::get_link, avg 3µs/call
44 }
45
4610916151.18s10916151.91s $result->{meta} = $self->_meta if $self->has_meta;
# spent 1.91s making 1091615 calls to PONAPI::Builder::Links::has_meta, avg 2µs/call
47
4810916153.47s return $result;
49}
50
5114µs22.50ms__PACKAGE__->meta->make_immutable;
# spent 2.48ms making 1 call to Class::MOP::Class::make_immutable # spent 16µs making 1 call to PONAPI::Builder::Links::meta
52362µs2135µs
# spent 72µs (9+63) within PONAPI::Builder::Links::BEGIN@52 which was called: # once (9µs+63µs) by PONAPI::Builder::Role::HasLinksBuilder::BEGIN@6 at line 52
no Moose; 1;
# spent 72µs making 1 call to PONAPI::Builder::Links::BEGIN@52 # spent 63µs making 1 call to Moose::unimport
53
54__END__