Filename | /var/www/foswikidev/core/lib/Foswiki/Macros/IF.pm |
Statements | Executed 697 statements in 1.97ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
43 | 1 | 1 | 1.64ms | 39.8ms | IF | Foswiki::
43 | 1 | 1 | 408µs | 16.6ms | __ANON__[:50] | Foswiki::
43 | 1 | 1 | 92µs | 92µs | __ANON__[:59] | Foswiki::
1 | 1 | 1 | 14µs | 27µs | BEGIN@4.65 | Foswiki::
1 | 1 | 1 | 11µs | 15µs | BEGIN@5.66 | Foswiki::
1 | 1 | 1 | 4µs | 4µs | BEGIN@7.67 | Foswiki::
0 | 0 | 0 | 0s | 0s | __ANON__[:56] | 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 | 27µs | 2 | 40µs | # spent 27µs (14+13) within Foswiki::BEGIN@4.65 which was called:
# once (14µs+13µs) by Foswiki::_expandMacroOnTopicRendering at line 4 # spent 27µs making 1 call to Foswiki::BEGIN@4.65
# spent 13µs making 1 call to strict::import |
5 | 2 | 44µs | 2 | 19µs | # spent 15µs (11+4) within Foswiki::BEGIN@5.66 which was called:
# once (11µs+4µs) by Foswiki::_expandMacroOnTopicRendering at line 5 # spent 15µs making 1 call to Foswiki::BEGIN@5.66
# spent 4µs making 1 call to warnings::import |
6 | |||||
7 | # spent 4µs within Foswiki::BEGIN@7.67 which was called:
# once (4µs+0s) by Foswiki::_expandMacroOnTopicRendering at line 12 | ||||
8 | 1 | 4µs | if ( $Foswiki::cfg{UseLocale} ) { | ||
9 | require locale; | ||||
10 | import locale(); | ||||
11 | } | ||||
12 | 1 | 290µs | 1 | 4µs | } # spent 4µs making 1 call to Foswiki::BEGIN@7.67 |
13 | |||||
14 | 1 | 200ns | our $ifParser; | ||
15 | |||||
16 | # spent 39.8ms (1.64+38.1) within Foswiki::IF which was called 43 times, avg 925µs/call:
# 43 times (1.64ms+38.1ms) by Foswiki::_expandMacroOnTopicRendering at line 3435 of /var/www/foswikidev/core/lib/Foswiki.pm, avg 925µs/call | ||||
17 | 43 | 23µs | my ( $this, $params, $topicObject ) = @_; | ||
18 | |||||
19 | 43 | 10µs | unless ($ifParser) { | ||
20 | 1 | 69µs | require Foswiki::If::Parser; | ||
21 | 1 | 3µs | 1 | 1.48ms | $ifParser = new Foswiki::If::Parser(); # spent 1.48ms making 1 call to Foswiki::If::Parser::new |
22 | } | ||||
23 | |||||
24 | 43 | 17µs | my $texpr = $params->{_DEFAULT}; | ||
25 | 43 | 5µs | $texpr = '' unless defined $texpr; | ||
26 | 43 | 4µs | my $expr; | ||
27 | 43 | 3µs | my $result; | ||
28 | |||||
29 | # Recursion block. | ||||
30 | 43 | 14µs | $this->{evaluating_if} ||= {}; | ||
31 | |||||
32 | # Block after 5 levels. | ||||
33 | 43 | 29µs | if ( $this->{evaluating_if}->{$texpr} | ||
34 | && $this->{evaluating_if}->{$texpr} > 5 ) | ||||
35 | { | ||||
36 | delete $this->{evaluating_if}->{$texpr}; | ||||
37 | return ''; | ||||
38 | } | ||||
39 | 43 | 50µs | $this->{evaluating_if}->{$texpr}++; | ||
40 | # spent 16.6ms (408µs+16.2) within Foswiki::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Macros/IF.pm:50] which was called 43 times, avg 385µs/call:
# 43 times (408µs+16.2ms) by Error::subs::try at line 419 of Error.pm, avg 385µs/call | ||||
41 | 43 | 68µs | 43 | 8.58ms | $expr = $ifParser->parse($texpr); # spent 8.58ms making 43 calls to Foswiki::Infix::Parser::parse, avg 200µs/call |
42 | 43 | 158µs | 43 | 7.32ms | if ( $expr->evaluate( tom => $topicObject, data => $topicObject ) ) { # spent 7.32ms making 43 calls to Foswiki::Query::Node::evaluate, avg 170µs/call |
43 | 20 | 9µs | $params->{then} = '' unless defined $params->{then}; | ||
44 | 20 | 34µs | 20 | 164µs | $result = expandStandardEscapes( $params->{then} ); # spent 164µs making 20 calls to Foswiki::expandStandardEscapes, avg 8µs/call |
45 | } | ||||
46 | else { | ||||
47 | 23 | 19µs | $params->{else} = '' unless defined $params->{else}; | ||
48 | 23 | 37µs | 23 | 92µs | $result = expandStandardEscapes( $params->{else} ); # spent 92µs making 23 calls to Foswiki::expandStandardEscapes, avg 4µs/call |
49 | } | ||||
50 | } | ||||
51 | catch Foswiki::Infix::Error with { | ||||
52 | my $e = shift; | ||||
53 | $result = | ||||
54 | $this->inlineAlert( 'alerts', 'generic', 'IF{', $params->stringify(), | ||||
55 | '}:', $e->{-text} ); | ||||
56 | } | ||||
57 | # spent 92µs within Foswiki::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Macros/IF.pm:59] which was called 43 times, avg 2µs/call:
# 43 times (92µs+0s) by Error::subs::try at line 433 of Error.pm, avg 2µs/call | ||||
58 | 43 | 126µs | delete $this->{evaluating_if}->{$texpr}; | ||
59 | 43 | 749µs | 172 | 298µs | }; # spent 140µs making 43 calls to Error::catch, avg 3µs/call
# spent 109µs making 43 calls to Error::subs::finally, avg 3µs/call
# spent 48µs making 43 calls to Error::subs::with, avg 1µs/call
# spent 17.1ms making 43 calls to Error::subs::try, avg 399µs/call, recursion: max depth 3, sum of overlapping time 17.1ms |
60 | 43 | 179µs | return $result; | ||
61 | } | ||||
62 | |||||
63 | 1 | 2µs | 1; | ||
64 | __END__ |