Filename | /var/www/foswikidev/core/lib/Foswiki/Macros/META.pm |
Statements | Executed 30 statements in 468µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
3 | 1 | 1 | 515µs | 9.33ms | META | Foswiki::
1 | 1 | 1 | 15µs | 27µs | BEGIN@4.77 | Foswiki::
1 | 1 | 1 | 10µs | 14µs | BEGIN@5.78 | Foswiki::
1 | 1 | 1 | 4µs | 4µs | BEGIN@7.79 | Foswiki::
1 | 1 | 1 | 3µs | 3µs | BEGIN@10 | Foswiki::
1 | 1 | 1 | 3µs | 3µs | BEGIN@8 | 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 | 29µs | 2 | 40µs | # spent 27µs (15+12) within Foswiki::BEGIN@4.77 which was called:
# once (15µs+12µs) by Foswiki::_expandMacroOnTopicRendering at line 4 # spent 27µs making 1 call to Foswiki::BEGIN@4.77
# spent 12µs making 1 call to strict::import |
5 | 2 | 25µs | 2 | 19µs | # spent 14µs (10+5) within Foswiki::BEGIN@5.78 which was called:
# once (10µs+5µs) by Foswiki::_expandMacroOnTopicRendering at line 5 # spent 14µs making 1 call to Foswiki::BEGIN@5.78
# spent 5µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 20µs | 1 | 4µs | # spent 4µs within Foswiki::BEGIN@7.79 which was called:
# once (4µs+0s) by Foswiki::_expandMacroOnTopicRendering at line 7 # spent 4µs making 1 call to Foswiki::BEGIN@7.79 |
8 | 2 | 44µs | 1 | 3µs | # spent 3µs within Foswiki::BEGIN@8 which was called:
# once (3µs+0s) by Foswiki::_expandMacroOnTopicRendering at line 8 # spent 3µs making 1 call to Foswiki::BEGIN@8 |
9 | |||||
10 | # spent 3µs within Foswiki::BEGIN@10 which was called:
# once (3µs+0s) by Foswiki::_expandMacroOnTopicRendering at line 15 | ||||
11 | 1 | 4µs | if ( $Foswiki::cfg{UseLocale} ) { | ||
12 | require locale; | ||||
13 | import locale(); | ||||
14 | } | ||||
15 | 1 | 237µs | 1 | 3µs | } # spent 3µs making 1 call to Foswiki::BEGIN@10 |
16 | |||||
17 | # See System.VarMETA | ||||
18 | # Before calling, ensure the topicObject is loaded with the version of the | ||||
19 | # topic you intend to display! | ||||
20 | # spent 9.33ms (515µs+8.81) within Foswiki::META which was called 3 times, avg 3.11ms/call:
# 3 times (515µs+8.81ms) by Foswiki::_expandMacroOnTopicRendering at line 3435 of /var/www/foswikidev/core/lib/Foswiki.pm, avg 3.11ms/call | ||||
21 | 3 | 2µs | my ( $this, $params, $topicObject ) = @_; | ||
22 | |||||
23 | 3 | 4µs | my $option = $params->{_DEFAULT} || ''; | ||
24 | 3 | 2µs | if ( defined( $params->{topic} ) ) { | ||
25 | my $addrObj = Foswiki::Address->new( | ||||
26 | web => $topicObject->web, | ||||
27 | string => $params->{topic} | ||||
28 | ); | ||||
29 | if ( !$addrObj->equiv($topicObject) ) { | ||||
30 | my $meta = | ||||
31 | new Foswiki::Meta( $this, $addrObj->web, $addrObj->topic ); | ||||
32 | $topicObject = $meta; | ||||
33 | } | ||||
34 | } | ||||
35 | |||||
36 | # make sure the topicObject is loaded | ||||
37 | 3 | 8µs | 3 | 8µs | my $loadedRev = $topicObject->getLoadedRev(); # spent 8µs making 3 calls to Foswiki::Meta::getLoadedRev, avg 3µs/call |
38 | 3 | 600ns | $topicObject = $topicObject->load() unless defined $loadedRev; | ||
39 | |||||
40 | 3 | 21µs | 3 | 8.72ms | if ( $option eq 'form' ) { # spent 5.92ms making 1 call to Foswiki::Meta::renderFormForDisplay
# spent 2.78ms making 1 call to Foswiki::attach
# spent 17µs making 1 call to Foswiki::Attach::renderMetaData |
41 | |||||
42 | # META:FORM and META:FIELD | ||||
43 | return $topicObject->renderFormForDisplay(); | ||||
44 | } | ||||
45 | elsif ( $option eq 'formfield' ) { | ||||
46 | |||||
47 | # a formfield from within topic text | ||||
48 | return $topicObject->renderFormFieldForDisplay( | ||||
49 | $params->get('name'), | ||||
50 | Foswiki::isTrue( $params->{display} ) | ||||
51 | ? '$value(display)' | ||||
52 | : '$value', | ||||
53 | $params | ||||
54 | ); | ||||
55 | } | ||||
56 | elsif ( $option eq 'attachments' ) { | ||||
57 | |||||
58 | # renders attachment tables | ||||
59 | return $this->attach->renderMetaData( $topicObject, $params ); | ||||
60 | } | ||||
61 | elsif ( $option eq 'moved' ) { | ||||
62 | require Foswiki::Render::Moved; | ||||
63 | return Foswiki::Render::Moved::render( $this, $topicObject, $params ); | ||||
64 | } | ||||
65 | elsif ( $option eq 'parent' ) { | ||||
66 | |||||
67 | # Only parent parameter has the format option and should do std escapes | ||||
68 | 1 | 63µs | require Foswiki::Render::Parent; | ||
69 | 1 | 6µs | 2 | 33µs | return expandStandardEscapes( # spent 30µs making 1 call to Foswiki::Render::Parent::render
# spent 3µs making 1 call to Foswiki::expandStandardEscapes |
70 | Foswiki::Render::Parent::render( $this, $topicObject, $params ) ); | ||||
71 | } | ||||
72 | |||||
73 | # return nothing if invalid parameter | ||||
74 | return ''; | ||||
75 | } | ||||
76 | |||||
77 | 1 | 2µs | 1; | ||
78 | __END__ |