← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 18:42:36 2015
Reported on Fri Jul 31 18:48:15 2015

Filename/var/www/foswikidev/core/lib/Foswiki/Render/Parent.pm
StatementsExecuted 35 statements in 447µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11124µs30µsFoswiki::Render::Parent::::renderFoswiki::Render::Parent::render
11113µs26µsFoswiki::Render::Parent::::BEGIN@4Foswiki::Render::Parent::BEGIN@4
1119µs13µsFoswiki::Render::Parent::::BEGIN@5Foswiki::Render::Parent::BEGIN@5
1119µs9µsFoswiki::Render::Parent::::BEGIN@10Foswiki::Render::Parent::BEGIN@10
1113µs3µsFoswiki::Render::Parent::::BEGIN@8Foswiki::Render::Parent::BEGIN@8
1113µs3µsFoswiki::Render::Parent::::BEGIN@7Foswiki::Render::Parent::BEGIN@7
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# See bottom of file for license and copyright information
2package Foswiki::Render::Parent;
3
4230µs238µs
# spent 26µs (13+12) within Foswiki::Render::Parent::BEGIN@4 which was called: # once (13µs+12µs) by Foswiki::META at line 4
use strict;
# spent 26µs making 1 call to Foswiki::Render::Parent::BEGIN@4 # spent 12µs making 1 call to strict::import
5223µs218µs
# spent 13µs (9+4) within Foswiki::Render::Parent::BEGIN@5 which was called: # once (9µs+4µs) by Foswiki::META at line 5
use warnings;
# spent 13µs making 1 call to Foswiki::Render::Parent::BEGIN@5 # spent 4µs making 1 call to warnings::import
6
7218µs13µs
# spent 3µs within Foswiki::Render::Parent::BEGIN@7 which was called: # once (3µs+0s) by Foswiki::META at line 7
use Foswiki ();
# spent 3µs making 1 call to Foswiki::Render::Parent::BEGIN@7
8243µs13µs
# spent 3µs within Foswiki::Render::Parent::BEGIN@8 which was called: # once (3µs+0s) by Foswiki::META at line 8
use Foswiki::Meta ();
# spent 3µs making 1 call to Foswiki::Render::Parent::BEGIN@8
9
10
# spent 9µs within Foswiki::Render::Parent::BEGIN@10 which was called: # once (9µs+0s) by Foswiki::META at line 15
BEGIN {
11110µs if ( $Foswiki::cfg{UseLocale} ) {
12 require locale;
13 import locale();
14 }
151303µs19µs}
# spent 9µs making 1 call to Foswiki::Render::Parent::BEGIN@10
16
17=begin TML
18
19---++ StaticMethod render($session, $topicObject, $params) -> $text
20
21Render parent meta-data. Support for %META%.
22
23=cut
24
25
# spent 30µs (24+7) within Foswiki::Render::Parent::render which was called: # once (24µs+7µs) by Foswiki::META at line 69 of /var/www/foswikidev/core/lib/Foswiki/Macros/META.pm
sub render {
261800ns my ( $session, $topicObject, $ah ) = @_;
271900ns my $dontRecurse = $ah->{dontrecurse} || 0;
281200ns my $depth = $ah->{depth} || 0;
291600ns my $noWebHome = $ah->{nowebhome} || 0;
301300ns my $prefix = $ah->{prefix} || '';
311300ns my $suffix = $ah->{suffix} || '';
321400ns my $usesep = $ah->{separator} || ' > ';
331300ns my $format = $ah->{format} || '[[$web.$topic][$topic]]';
34
3513µs24µs my ( $web, $topic ) = ( $topicObject->web, $topicObject->topic );
# spent 2µs making 1 call to Foswiki::Meta::web # spent 2µs making 1 call to Foswiki::Meta::topic
361200ns return '' unless $web && $topic;
37
381200ns my %visited;
3912µs $visited{ $web . '.' . $topic } = 1;
40
411300ns my $pWeb = $web;
421100ns my $pTopic;
431200ns my $text = '';
4411µs12µs my $parentMeta = $topicObject->get('TOPICPARENT');
# spent 2µs making 1 call to Foswiki::Meta::get
451100ns my $parent;
46
471100ns $parent = $parentMeta->{name} if $parentMeta;
48
491200ns my @stack;
501200ns my $currentDepth = 0;
511100ns $depth = 1 if $dontRecurse;
52
531400ns while ($parent) {
54 $currentDepth++;
55 ( $pWeb, $pTopic ) = $session->normalizeWebTopicName( $pWeb, $parent );
56 $parent = $pWeb . '.' . $pTopic;
57 last
58 if ( $noWebHome && ( $pTopic eq $Foswiki::cfg{HomeTopicName} )
59 || $visited{$parent} );
60 $visited{$parent} = 1;
61 $text = $format;
62 $text =~ s/\$web/$pWeb/g;
63 $text =~ s/\$topic/$pTopic/g;
64
65 if ( !$depth or $currentDepth == $depth ) {
66 unshift( @stack, $text );
67 }
68 last if $currentDepth == $depth;
69
70 # Compromise; rather than supporting a hack in the store to support
71 # rapid access to parent meta (as in TWiki) accept the hit
72 # of reading the whole topic.
73 my $topicObject = Foswiki::Meta->load( $session, $pWeb, $pTopic );
74 my $parentMeta = $topicObject->get('TOPICPARENT');
75 $parent = $parentMeta->{name} if $parentMeta;
76 }
771500ns $text = join( $usesep, @stack );
78
791100ns if ($text) {
80 $text = $prefix . $text if ($prefix);
81 $text .= $suffix if ($suffix);
82 }
83
8415µs return $text;
85}
86
8712µs1;
88__END__