Filename | /usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/ADDTOZONE.pm |
Statements | Executed 55 statements in 617µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
4 | 1 | 1 | 152µs | 385µs | ADDTOZONE | Foswiki::
1 | 1 | 1 | 32µs | 40µs | BEGIN@4.25 | Foswiki::
1 | 1 | 1 | 20µs | 66µs | BEGIN@7 | Foswiki::
1 | 1 | 1 | 17µs | 37µs | BEGIN@5.26 | Foswiki::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | package Foswiki; | ||||
3 | |||||
4 | 2 | 47µs | 2 | 48µs | # spent 40µs (32+8) within Foswiki::BEGIN@4.25 which was called:
# once (32µs+8µs) by Foswiki::_expandMacroOnTopicRendering at line 4 # spent 40µs making 1 call to Foswiki::BEGIN@4.25
# spent 8µs making 1 call to strict::import |
5 | 2 | 46µs | 2 | 56µs | # spent 37µs (17+19) within Foswiki::BEGIN@5.26 which was called:
# once (17µs+19µs) by Foswiki::_expandMacroOnTopicRendering at line 5 # spent 37µs making 1 call to Foswiki::BEGIN@5.26
# spent 19µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 374µs | 2 | 111µs | # spent 66µs (20+45) within Foswiki::BEGIN@7 which was called:
# once (20µs+45µs) by Foswiki::_expandMacroOnTopicRendering at line 7 # spent 66µs making 1 call to Foswiki::BEGIN@7
# spent 45µs making 1 call to Assert::import |
8 | |||||
9 | # spent 385µs (152+234) within Foswiki::ADDTOZONE which was called 4 times, avg 96µs/call:
# 4 times (152µs+234µs) by Foswiki::_expandMacroOnTopicRendering at line 3066 of /usr/local/src/github.com/foswiki/core/lib/Foswiki.pm, avg 96µs/call | ||||
10 | 40 | 105µs | my ( $this, $params, $topicObject ) = @_; | ||
11 | |||||
12 | my $zones = $params->{_DEFAULT} || $params->{zone} || 'head'; | ||||
13 | my $id = $params->{id} || $params->{tag} || ''; | ||||
14 | my $topic = $params->{topic} || ''; | ||||
15 | my $section = $params->{section} || ''; | ||||
16 | my $requires = $params->{requires} || ''; | ||||
17 | my $text = $params->{text} || ''; | ||||
18 | |||||
19 | # when there's a topic or a section parameter, then create an include | ||||
20 | # this overrides the text parameter | ||||
21 | if ( $topic || $section ) { | ||||
22 | my $web = $topicObject->web; | ||||
23 | $topic ||= $topicObject->topic; | ||||
24 | ( $web, $topic ) = $this->normalizeWebTopicName( $web, $topic ); | ||||
25 | |||||
26 | # generate TML only and delay expansion until the zone is rendered | ||||
27 | $text = '%INCLUDE{"' . $web . '.' . $topic . '"'; | ||||
28 | $text .= ' section="' . $section . '"' if $section; | ||||
29 | $text .= ' warn="off"}%'; | ||||
30 | } | ||||
31 | |||||
32 | foreach my $zone ( split( /\s*,\s*/, $zones ) ) { | ||||
33 | 8 | 40µs | if ( $zone eq 'body' ) { | ||
34 | |||||
35 | #print STDERR "WARNING: ADDTOZONE was called for zone 'body' ... rerouting it to zone 'script' ... please fix your templates\n"; | ||||
36 | $zone = 'script'; | ||||
37 | } | ||||
38 | 4 | 218µs | $this->addToZone( $zone, $id, $text, $requires ); # spent 218µs making 4 calls to Foswiki::addToZone, avg 54µs/call | ||
39 | } | ||||
40 | |||||
41 | 4 | 16µs | return (DEBUG) ? "<!--A2Z:$id-->" : ''; # spent 16µs making 4 calls to Assert::ASSERTS_OFF, avg 4µs/call | ||
42 | } | ||||
43 | |||||
44 | 1 | 4µs | 1; | ||
45 | __END__ |