Filename | /var/www/foswiki11/lib/Foswiki/Macros/META.pm |
Statements | Executed 20 statements in 294µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
3 | 1 | 1 | 56µs | 20.3ms | META | Foswiki::
1 | 1 | 1 | 16µs | 33µs | BEGIN@4.47 | Foswiki::
1 | 1 | 1 | 11µs | 17µs | BEGIN@5.48 | 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 | 35µs | 2 | 50µs | # spent 33µs (16+17) within Foswiki::BEGIN@4.47 which was called:
# once (16µs+17µs) by Foswiki::_expandMacroOnTopicRendering at line 4 # spent 33µs making 1 call to Foswiki::BEGIN@4.47
# spent 17µs making 1 call to strict::import |
5 | 2 | 210µs | 2 | 24µs | # spent 17µs (11+7) within Foswiki::BEGIN@5.48 which was called:
# once (11µs+7µs) by Foswiki::_expandMacroOnTopicRendering at line 5 # spent 17µs making 1 call to Foswiki::BEGIN@5.48
# spent 7µs making 1 call to warnings::import |
6 | |||||
7 | # See System.VarMETA | ||||
8 | # Before calling, ensure the topicObject is loaded with the version of the | ||||
9 | # topic you intend to display! | ||||
10 | # spent 20.3ms (56µs+20.2) within Foswiki::META which was called 3 times, avg 6.76ms/call:
# 3 times (56µs+20.2ms) by Foswiki::_expandMacroOnTopicRendering at line 3160 of /var/www/foswiki11/lib/Foswiki.pm, avg 6.76ms/call | ||||
11 | 3 | 2µs | my ( $this, $params, $topicObject ) = @_; | ||
12 | |||||
13 | 3 | 4µs | my $option = $params->{_DEFAULT} || ''; | ||
14 | |||||
15 | # make sure the topicObject is loaded | ||||
16 | 3 | 9µs | 3 | 23µs | my $loadedRev = $topicObject->getLoadedRev(); # spent 23µs making 3 calls to Foswiki::Meta::getLoadedRev, avg 8µs/call |
17 | 3 | 800ns | $topicObject->load() unless defined $loadedRev; | ||
18 | |||||
19 | 3 | 30µs | 6 | 20.2ms | if ( $option eq 'form' ) { # spent 12.9ms making 1 call to Foswiki::renderer
# spent 4.91ms making 1 call to Foswiki::Meta::renderFormForDisplay
# spent 2.36ms making 1 call to Foswiki::attach
# spent 44µs making 1 call to Foswiki::Render::renderParent
# spent 23µs making 1 call to Foswiki::Attach::renderMetaData
# spent 5µs making 1 call to Foswiki::expandStandardEscapes |
20 | |||||
21 | # META:FORM and META:FIELD | ||||
22 | return $topicObject->renderFormForDisplay(); | ||||
23 | } | ||||
24 | elsif ( $option eq 'formfield' ) { | ||||
25 | |||||
26 | # a formfield from within topic text | ||||
27 | return $topicObject->renderFormFieldForDisplay( $params->get('name'), | ||||
28 | '$value', $params ); | ||||
29 | } | ||||
30 | elsif ( $option eq 'attachments' ) { | ||||
31 | |||||
32 | # renders attachment tables | ||||
33 | return $this->attach->renderMetaData( $topicObject, $params ); | ||||
34 | } | ||||
35 | elsif ( $option eq 'moved' ) { | ||||
36 | return $this->renderer->renderMoved( $topicObject, $params ); | ||||
37 | } | ||||
38 | elsif ( $option eq 'parent' ) { | ||||
39 | |||||
40 | # Only parent parameter has the format option and should do std escapes | ||||
41 | return expandStandardEscapes( | ||||
42 | $this->renderer->renderParent( $topicObject, $params ) ); | ||||
43 | } | ||||
44 | |||||
45 | # return nothing if invalid parameter | ||||
46 | return ''; | ||||
47 | } | ||||
48 | |||||
49 | 1 | 3µs | 1; | ||
50 | __END__ |