Filename | /usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/QUERY.pm |
Statements | Executed 28 statements in 902µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 128µs | 11.1ms | QUERY | Foswiki::
1 | 1 | 1 | 44µs | 2.84ms | __ANON__[:56] | Foswiki::
1 | 1 | 1 | 27µs | 35µs | BEGIN@4.65 | Foswiki::
1 | 1 | 1 | 23µs | 41µs | BEGIN@5.66 | Foswiki::
1 | 1 | 1 | 11µs | 11µs | BEGIN@6.67 | Foswiki::
1 | 1 | 1 | 6µs | 6µs | __ANON__[:65] | Foswiki::
0 | 0 | 0 | 0s | 0s | __ANON__[:62] | 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 | 62µs | 2 | 42µs | # spent 35µs (27+7) within Foswiki::BEGIN@4.65 which was called:
# once (27µs+7µs) by Foswiki::_expandMacroOnTopicRendering at line 4 # spent 35µs making 1 call to Foswiki::BEGIN@4.65
# spent 8µs making 1 call to strict::import |
5 | 2 | 44µs | 2 | 59µs | # spent 41µs (23+18) within Foswiki::BEGIN@5.66 which was called:
# once (23µs+18µs) by Foswiki::_expandMacroOnTopicRendering at line 5 # spent 41µs making 1 call to Foswiki::BEGIN@5.66
# spent 18µs making 1 call to warnings::import |
6 | 2 | 622µs | 1 | 11µs | # spent 11µs within Foswiki::BEGIN@6.67 which was called:
# once (11µs+0s) by Foswiki::_expandMacroOnTopicRendering at line 6 # spent 11µs making 1 call to Foswiki::BEGIN@6.67 |
7 | |||||
8 | 1 | 1µs | our $evalParser; # could share $ifParser from IF.pm | ||
9 | |||||
10 | # spent 11.1ms (128µs+11.0) within Foswiki::QUERY which was called:
# once (128µs+11.0ms) by Foswiki::_expandMacroOnTopicRendering at line 3066 of /usr/local/src/github.com/foswiki/core/lib/Foswiki.pm | ||||
11 | 16 | 123µs | my ( $this, $params, $topicObject ) = @_; | ||
12 | my $result; | ||||
13 | my $expr = $params->{_DEFAULT}; | ||||
14 | $expr = '' unless defined $expr; | ||||
15 | my $style = lc( $params->{style} || 'default' ); | ||||
16 | my $rev = $params->{rev}; | ||||
17 | |||||
18 | # FORMFIELD does its own caching. | ||||
19 | # Either the home-made cache there should go into Meta so that both | ||||
20 | # FORMFIELD and QUERY benefit, or the store should be made a lot smarter. | ||||
21 | |||||
22 | 1 | 32µs | if ( defined $rev ) { # spent 32µs making 1 call to Foswiki::Meta::latestIsLoaded | ||
23 | my $crev = $topicObject->getLoadedRev(); | ||||
24 | if ( defined $crev && $crev != $rev ) { | ||||
25 | $topicObject = | ||||
26 | Foswiki::Meta->load( $topicObject->session, $topicObject->web, | ||||
27 | $topicObject->topic, $rev ); | ||||
28 | } | ||||
29 | } | ||||
30 | elsif ( !$topicObject->latestIsLoaded() ) { | ||||
31 | |||||
32 | # load latest rev | ||||
33 | 1 | 6.03ms | $topicObject = $topicObject->load(); # spent 6.03ms making 1 call to Foswiki::Meta::load | ||
34 | } | ||||
35 | |||||
36 | # Recursion block. | ||||
37 | $this->{evaluatingEval} ||= {}; | ||||
38 | |||||
39 | # Block after 5 levels. | ||||
40 | if ( $this->{evaluatingEval}->{$expr} | ||||
41 | && $this->{evaluatingEval}->{$expr} > 5 ) | ||||
42 | { | ||||
43 | delete $this->{evaluatingEval}->{$expr}; | ||||
44 | return ''; | ||||
45 | } | ||||
46 | unless ($evalParser) { | ||||
47 | require Foswiki::Query::Parser; | ||||
48 | 1 | 1.95ms | $evalParser = new Foswiki::Query::Parser(); # spent 1.95ms making 1 call to Foswiki::Query::Parser::new | ||
49 | } | ||||
50 | |||||
51 | $this->{evaluatingEval}->{$expr}++; | ||||
52 | # spent 2.84ms (44µs+2.80) within Foswiki::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/QUERY.pm:56] which was called:
# once (44µs+2.80ms) by Error::subs::try at line 416 of Error.pm | ||||
53 | 3 | 36µs | 1 | 2.02ms | my $node = $evalParser->parse($expr); # spent 2.02ms making 1 call to Foswiki::Infix::Parser::parse |
54 | 1 | 48µs | $result = $node->evaluate( tom => $topicObject, data => $topicObject ); # spent 48µs making 1 call to Foswiki::Query::Node::evaluate | ||
55 | 1 | 729µs | $result = Foswiki::Serialise::serialise( $this, $result, $style ); # spent 729µs making 1 call to Foswiki::Serialise::serialise | ||
56 | } | ||||
57 | catch Foswiki::Infix::Error with { | ||||
58 | my $e = shift; | ||||
59 | $result = | ||||
60 | $this->inlineAlert( 'alerts', 'generic', 'QUERY{', | ||||
61 | $params->stringify(), '}:', $e->{-text} ); | ||||
62 | } | ||||
63 | # spent 6µs within Foswiki::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Macros/QUERY.pm:65] which was called:
# once (6µs+0s) by Error::subs::try at line 430 of Error.pm | ||||
64 | 1 | 9µs | delete $this->{evaluatingEval}->{$expr}; | ||
65 | 4 | 36µs | }; # spent 20µs making 1 call to Error::catch
# spent 10µs making 1 call to Error::subs::finally
# spent 7µs making 1 call to Error::subs::with
# spent 2.91ms making 1 call to Error::subs::try, recursion: max depth 1, sum of overlapping time 2.91ms | ||
66 | |||||
67 | return $result; | ||||
68 | } | ||||
69 | |||||
70 | 1 | 5µs | 1; | ||
71 | __END__ |