Filename | /usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/IF.pm |
Statements | Executed 1208 statements in 8.34ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
75 | 1 | 1 | 6.02ms | 134ms | IF | Foswiki::
75 | 1 | 1 | 2.18ms | 79.9ms | __ANON__[:43] | Foswiki::
75 | 1 | 1 | 412µs | 412µs | __ANON__[:52] | Foswiki::
1 | 1 | 1 | 25µs | 33µs | BEGIN@4.27 | Foswiki::
1 | 1 | 1 | 17µs | 36µs | BEGIN@5.28 | Foswiki::
0 | 0 | 0 | 0s | 0s | __ANON__[:49] | 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 | 53µs | 2 | 40µs | # spent 33µs (25+7) within Foswiki::BEGIN@4.27 which was called:
# once (25µs+7µs) by Foswiki::_expandMacroOnTopicRendering at line 4 # spent 33µs making 1 call to Foswiki::BEGIN@4.27
# spent 7µs making 1 call to strict::import |
5 | 2 | 524µs | 2 | 55µs | # spent 36µs (17+19) within Foswiki::BEGIN@5.28 which was called:
# once (17µs+19µs) by Foswiki::_expandMacroOnTopicRendering at line 5 # spent 36µs making 1 call to Foswiki::BEGIN@5.28
# spent 19µs making 1 call to warnings::import |
6 | |||||
7 | 1 | 1µs | our $ifParser; | ||
8 | |||||
9 | # spent 134ms (6.02+128) within Foswiki::IF which was called 75 times, avg 1.78ms/call:
# 75 times (6.02ms+128ms) by Foswiki::_expandMacroOnTopicRendering at line 3066 of /usr/local/src/github.com/foswiki/core/lib/Foswiki.pm, avg 1.78ms/call | ||||
10 | 825 | 5.05ms | my ( $this, $params, $topicObject ) = @_; | ||
11 | |||||
12 | 2 | 110µs | unless ($ifParser) { | ||
13 | require Foswiki::If::Parser; | ||||
14 | 1 | 3.54ms | $ifParser = new Foswiki::If::Parser(); # spent 3.54ms making 1 call to Foswiki::If::Parser::new | ||
15 | } | ||||
16 | |||||
17 | my $texpr = $params->{_DEFAULT}; | ||||
18 | $texpr = '' unless defined $texpr; | ||||
19 | my $expr; | ||||
20 | my $result; | ||||
21 | |||||
22 | # Recursion block. | ||||
23 | $this->{evaluating_if} ||= {}; | ||||
24 | |||||
25 | # Block after 5 levels. | ||||
26 | if ( $this->{evaluating_if}->{$texpr} | ||||
27 | && $this->{evaluating_if}->{$texpr} > 5 ) | ||||
28 | { | ||||
29 | delete $this->{evaluating_if}->{$texpr}; | ||||
30 | return ''; | ||||
31 | } | ||||
32 | $this->{evaluating_if}->{$texpr}++; | ||||
33 | # spent 79.9ms (2.18+77.7) within Foswiki::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/IF.pm:43] which was called 75 times, avg 1.07ms/call:
# 75 times (2.18ms+77.7ms) by Error::subs::try at line 416 of Error.pm, avg 1.07ms/call | ||||
34 | 150 | 1.38ms | 75 | 44.2ms | $expr = $ifParser->parse($texpr); # spent 44.2ms making 75 calls to Foswiki::Infix::Parser::parse, avg 589µs/call |
35 | 150 | 727µs | 75 | 28.3ms | if ( $expr->evaluate( tom => $topicObject, data => $topicObject ) ) { # spent 28.3ms making 75 calls to Foswiki::Query::Node::evaluate, avg 378µs/call |
36 | $params->{then} = '' unless defined $params->{then}; | ||||
37 | 14 | 999µs | $result = expandStandardEscapes( $params->{then} ); # spent 999µs making 14 calls to Foswiki::expandStandardEscapes, avg 71µs/call | ||
38 | } | ||||
39 | else { | ||||
40 | $params->{else} = '' unless defined $params->{else}; | ||||
41 | 61 | 4.21ms | $result = expandStandardEscapes( $params->{else} ); # spent 4.21ms making 61 calls to Foswiki::expandStandardEscapes, avg 69µs/call | ||
42 | } | ||||
43 | } | ||||
44 | catch Foswiki::Infix::Error with { | ||||
45 | my $e = shift; | ||||
46 | $result = | ||||
47 | $this->inlineAlert( 'alerts', 'generic', 'IF{', $params->stringify(), | ||||
48 | '}:', $e->{-text} ); | ||||
49 | } | ||||
50 | # spent 412µs within Foswiki::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/IF.pm:52] which was called 75 times, avg 5µs/call:
# 75 times (412µs+0s) by Error::subs::try at line 430 of Error.pm, avg 5µs/call | ||||
51 | 75 | 492µs | delete $this->{evaluating_if}->{$texpr}; | ||
52 | 300 | 2.13ms | }; # spent 1.14ms making 75 calls to Error::catch, avg 15µs/call
# spent 665µs making 75 calls to Error::subs::finally, avg 9µs/call
# spent 331µs making 75 calls to Error::subs::with, avg 4µs/call
# spent 83.9ms making 75 calls to Error::subs::try, avg 1.12ms/call, recursion: max depth 3, sum of overlapping time 83.9ms | ||
53 | return $result; | ||||
54 | } | ||||
55 | |||||
56 | 1 | 5µs | 1; | ||
57 | __END__ |