Filename | /var/www/foswiki11/lib/Foswiki/Macros/IF.pm |
Statements | Executed 664 statements in 2.73ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
41 | 1 | 1 | 1.99ms | 77.0ms | IF | Foswiki::
41 | 1 | 1 | 528µs | 34.9ms | __ANON__[:43] | Foswiki::
41 | 1 | 1 | 116µs | 116µs | __ANON__[:52] | Foswiki::
1 | 1 | 1 | 24µs | 48µs | BEGIN@4.43 | Foswiki::
1 | 1 | 1 | 18µs | 27µs | BEGIN@5.44 | 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 | 50µs | 2 | 73µs | # spent 48µs (24+24) within Foswiki::BEGIN@4.43 which was called:
# once (24µs+24µs) by Foswiki::_expandMacroOnTopicRendering at line 4 # spent 48µs making 1 call to Foswiki::BEGIN@4.43
# spent 24µs making 1 call to strict::import |
5 | 2 | 581µs | 2 | 36µs | # spent 27µs (18+9) within Foswiki::BEGIN@5.44 which was called:
# once (18µs+9µs) by Foswiki::_expandMacroOnTopicRendering at line 5 # spent 27µs making 1 call to Foswiki::BEGIN@5.44
# spent 9µs making 1 call to warnings::import |
6 | |||||
7 | 1 | 200ns | our $ifParser; | ||
8 | |||||
9 | # spent 77.0ms (1.99+75.0) within Foswiki::IF which was called 41 times, avg 1.88ms/call:
# 41 times (1.99ms+75.0ms) by Foswiki::_expandMacroOnTopicRendering at line 3160 of /var/www/foswiki11/lib/Foswiki.pm, avg 1.88ms/call | ||||
10 | 41 | 29µs | my ( $this, $params, $topicObject ) = @_; | ||
11 | |||||
12 | 41 | 13µs | unless ($ifParser) { | ||
13 | 1 | 130µs | require Foswiki::If::Parser; | ||
14 | 1 | 6µs | 1 | 30.5ms | $ifParser = new Foswiki::If::Parser(); # spent 30.5ms making 1 call to Foswiki::If::Parser::new |
15 | } | ||||
16 | |||||
17 | 41 | 23µs | my $texpr = $params->{_DEFAULT}; | ||
18 | 41 | 7µs | $texpr = '' unless defined $texpr; | ||
19 | 41 | 5µs | my $expr; | ||
20 | 41 | 5µs | my $result; | ||
21 | |||||
22 | # Recursion block. | ||||
23 | 41 | 20µs | $this->{evaluating_if} ||= {}; | ||
24 | |||||
25 | # Block after 5 levels. | ||||
26 | 41 | 25µs | if ( $this->{evaluating_if}->{$texpr} | ||
27 | && $this->{evaluating_if}->{$texpr} > 5 ) | ||||
28 | { | ||||
29 | delete $this->{evaluating_if}->{$texpr}; | ||||
30 | return ''; | ||||
31 | } | ||||
32 | 41 | 60µs | $this->{evaluating_if}->{$texpr}++; | ||
33 | # spent 34.9ms (528µs+34.4) within Foswiki::__ANON__[/var/www/foswiki11/lib/Foswiki/Macros/IF.pm:43] which was called 41 times, avg 851µs/call:
# 41 times (528µs+34.4ms) by Error::subs::try at line 419 of Error.pm, avg 851µs/call | ||||
34 | 41 | 91µs | 41 | 22.5ms | $expr = $ifParser->parse($texpr); # spent 22.5ms making 41 calls to Foswiki::Infix::Parser::parse, avg 549µs/call |
35 | 41 | 191µs | 41 | 11.5ms | if ( $expr->evaluate( tom => $topicObject, data => $topicObject ) ) { # spent 11.5ms making 41 calls to Foswiki::Query::Node::evaluate, avg 280µs/call |
36 | 20 | 12µs | $params->{then} = '' unless defined $params->{then}; | ||
37 | 20 | 43µs | 20 | 215µs | $result = expandStandardEscapes( $params->{then} ); # spent 215µs making 20 calls to Foswiki::expandStandardEscapes, avg 11µs/call |
38 | } | ||||
39 | else { | ||||
40 | 21 | 42µs | $params->{else} = '' unless defined $params->{else}; | ||
41 | 21 | 44µs | 21 | 136µs | $result = expandStandardEscapes( $params->{else} ); # spent 136µs making 21 calls to Foswiki::expandStandardEscapes, avg 6µ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 116µs within Foswiki::__ANON__[/var/www/foswiki11/lib/Foswiki/Macros/IF.pm:52] which was called 41 times, avg 3µs/call:
# 41 times (116µs+0s) by Error::subs::try at line 433 of Error.pm, avg 3µs/call | ||||
51 | 41 | 154µs | delete $this->{evaluating_if}->{$texpr}; | ||
52 | 41 | 978µs | 164 | 406µs | }; # spent 199µs making 41 calls to Error::catch, avg 5µs/call
# spent 144µs making 41 calls to Error::subs::finally, avg 4µs/call
# spent 62µs making 41 calls to Error::subs::with, avg 2µs/call
# spent 35.6ms making 41 calls to Error::subs::try, avg 869µs/call, recursion: max depth 3, sum of overlapping time 35.6ms |
53 | 41 | 214µs | return $result; | ||
54 | } | ||||
55 | |||||
56 | 1 | 4µs | 1; | ||
57 | __END__ |