Filename | /var/www/foswikidev/core/lib/Foswiki/Macros/QUERY.pm |
Statements | Executed 30 statements in 517µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 57µs | 1.71ms | QUERY | Foswiki::
1 | 1 | 1 | 21µs | 34µs | BEGIN@4.119 | Foswiki::
1 | 1 | 1 | 17µs | 814µs | __ANON__[:68] | Foswiki::
1 | 1 | 1 | 10µs | 14µs | BEGIN@5.120 | Foswiki::
1 | 1 | 1 | 5µs | 5µs | BEGIN@6.121 | Foswiki::
1 | 1 | 1 | 4µs | 4µs | BEGIN@8.122 | Foswiki::
1 | 1 | 1 | 2µs | 2µs | __ANON__[:77] | Foswiki::
0 | 0 | 0 | 0s | 0s | __ANON__[:74] | 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 | 29µs | 2 | 47µs | # spent 34µs (21+13) within Foswiki::BEGIN@4.119 which was called:
# once (21µs+13µs) by Foswiki::_expandMacroOnTopicRendering at line 4 # spent 34µs making 1 call to Foswiki::BEGIN@4.119
# spent 13µs making 1 call to strict::import |
5 | 2 | 25µs | 2 | 18µs | # spent 14µs (10+4) within Foswiki::BEGIN@5.120 which was called:
# once (10µs+4µs) by Foswiki::_expandMacroOnTopicRendering at line 5 # spent 14µs making 1 call to Foswiki::BEGIN@5.120
# spent 4µs making 1 call to warnings::import |
6 | 2 | 43µs | 1 | 5µs | # spent 5µs within Foswiki::BEGIN@6.121 which was called:
# once (5µs+0s) by Foswiki::_expandMacroOnTopicRendering at line 6 # spent 5µs making 1 call to Foswiki::BEGIN@6.121 |
7 | |||||
8 | # spent 4µs within Foswiki::BEGIN@8.122 which was called:
# once (4µs+0s) by Foswiki::_expandMacroOnTopicRendering at line 13 | ||||
9 | 1 | 4µs | if ( $Foswiki::cfg{UseLocale} ) { | ||
10 | require locale; | ||||
11 | import locale(); | ||||
12 | } | ||||
13 | 1 | 353µs | 1 | 4µs | } # spent 4µs making 1 call to Foswiki::BEGIN@8.122 |
14 | |||||
15 | 1 | 100ns | our $evalParser; # could share $ifParser from IF.pm | ||
16 | |||||
17 | # spent 1.71ms (57µs+1.65) within Foswiki::QUERY which was called:
# once (57µs+1.65ms) by Foswiki::_expandMacroOnTopicRendering at line 3435 of /var/www/foswikidev/core/lib/Foswiki.pm | ||||
18 | 1 | 600ns | my ( $this, $params, $topicObject ) = @_; | ||
19 | 1 | 200ns | my $result; | ||
20 | 1 | 500ns | my $expr = $params->{_DEFAULT}; | ||
21 | 1 | 200ns | $expr = '' unless defined $expr; | ||
22 | 1 | 1µs | my $style = ucfirst( lc( $params->{style} || 'default' ) ); | ||
23 | 1 | 900ns | if ( $style =~ m/[^a-zA-Z0-9_]/ ) { | ||
24 | return "%RED%QUERY: invalid 'style' parameter passed%ENDCOLOR%"; | ||||
25 | } | ||||
26 | 1 | 2µs | 1 | 4µs | $style = Foswiki::Sandbox::untaintUnchecked($style); # spent 4µs making 1 call to Foswiki::Sandbox::untaintUnchecked |
27 | |||||
28 | 1 | 300ns | my $rev = $params->{rev}; | ||
29 | |||||
30 | # FORMFIELD does its own caching. | ||||
31 | # Either the home-made cache there should go into Meta so that both | ||||
32 | # FORMFIELD and QUERY benefit, or the store should be made a lot smarter. | ||||
33 | |||||
34 | 1 | 3µs | 1 | 3µs | if ( defined $rev ) { # spent 3µs making 1 call to Foswiki::Meta::latestIsLoaded |
35 | my $crev = $topicObject->getLoadedRev(); | ||||
36 | if ( defined $crev && $crev != $rev ) { | ||||
37 | $topicObject = | ||||
38 | Foswiki::Meta->load( $topicObject->session, $topicObject->web, | ||||
39 | $topicObject->topic, $rev ); | ||||
40 | } | ||||
41 | } | ||||
42 | elsif ( !$topicObject->latestIsLoaded() ) { | ||||
43 | |||||
44 | # load latest rev | ||||
45 | $topicObject = $topicObject->load(); | ||||
46 | } | ||||
47 | |||||
48 | # Recursion block. | ||||
49 | 1 | 6µs | $this->{evaluatingEval} ||= {}; | ||
50 | |||||
51 | # Block after 5 levels. | ||||
52 | 1 | 400ns | if ( $this->{evaluatingEval}->{$expr} | ||
53 | && $this->{evaluatingEval}->{$expr} > 5 ) | ||||
54 | { | ||||
55 | delete $this->{evaluatingEval}->{$expr}; | ||||
56 | return ''; | ||||
57 | } | ||||
58 | 1 | 300ns | unless ($evalParser) { | ||
59 | 1 | 1µs | require Foswiki::Query::Parser; | ||
60 | 1 | 6µs | 1 | 808µs | $evalParser = new Foswiki::Query::Parser(); # spent 808µs making 1 call to Foswiki::Query::Parser::new |
61 | } | ||||
62 | |||||
63 | 1 | 1µs | $this->{evaluatingEval}->{$expr}++; | ||
64 | # spent 814µs (17+797) within Foswiki::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Macros/QUERY.pm:68] which was called:
# once (17µs+797µs) by Error::subs::try at line 419 of Error.pm | ||||
65 | 1 | 2µs | 1 | 400µs | my $node = $evalParser->parse($expr); # spent 400µs making 1 call to Foswiki::Infix::Parser::parse |
66 | 1 | 2µs | 1 | 8µs | $result = $node->evaluate( tom => $topicObject, data => $topicObject ); # spent 8µs making 1 call to Foswiki::Query::Node::evaluate |
67 | 1 | 8µs | 1 | 388µs | $result = Foswiki::Serialise::serialise( $result, $style ); # spent 388µs making 1 call to Foswiki::Serialise::serialise |
68 | } | ||||
69 | catch Foswiki::Infix::Error with { | ||||
70 | my $e = shift; | ||||
71 | $result = | ||||
72 | $this->inlineAlert( 'alerts', 'generic', 'QUERY{', | ||||
73 | $params->stringify(), '}:', $e->{-text} ); | ||||
74 | } | ||||
75 | # spent 2µs within Foswiki::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Macros/QUERY.pm:77] which was called:
# once (2µs+0s) by Error::subs::try at line 433 of Error.pm | ||||
76 | 1 | 4µs | delete $this->{evaluatingEval}->{$expr}; | ||
77 | 1 | 16µs | 4 | 8µs | }; # spent 4µs making 1 call to Error::catch
# spent 3µs making 1 call to Error::subs::finally
# spent 1µs making 1 call to Error::subs::with
# spent 832µs making 1 call to Error::subs::try, recursion: max depth 1, sum of overlapping time 832µs |
78 | |||||
79 | 1 | 4µs | return $result; | ||
80 | } | ||||
81 | |||||
82 | 1 | 2µs | 1; | ||
83 | __END__ |