← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 18:42:36 2015
Reported on Fri Jul 31 18:48:16 2015

Filename/var/www/foswikidev/core/lib/Foswiki/Macros/QUERY.pm
StatementsExecuted 30 statements in 517µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11157µs1.71msFoswiki::::QUERYFoswiki::QUERY
11121µs34µsFoswiki::::BEGIN@4.119Foswiki::BEGIN@4.119
11117µs814µsFoswiki::::__ANON__[:68]Foswiki::__ANON__[:68]
11110µs14µsFoswiki::::BEGIN@5.120Foswiki::BEGIN@5.120
1115µs5µsFoswiki::::BEGIN@6.121Foswiki::BEGIN@6.121
1114µs4µsFoswiki::::BEGIN@8.122Foswiki::BEGIN@8.122
1112µs2µsFoswiki::::__ANON__[:77]Foswiki::__ANON__[:77]
0000s0sFoswiki::::__ANON__[:74]Foswiki::__ANON__[:74]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# See bottom of file for license and copyright information
2package Foswiki;
3
4229µs247µ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
use strict;
# spent 34µs making 1 call to Foswiki::BEGIN@4.119 # spent 13µs making 1 call to strict::import
5225µs218µ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
use warnings;
# spent 14µs making 1 call to Foswiki::BEGIN@5.120 # spent 4µs making 1 call to warnings::import
6243µs15µs
# spent 5µs within Foswiki::BEGIN@6.121 which was called: # once (5µs+0s) by Foswiki::_expandMacroOnTopicRendering at line 6
use Foswiki::Serialise ();
# 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
BEGIN {
914µs if ( $Foswiki::cfg{UseLocale} ) {
10 require locale;
11 import locale();
12 }
131353µs14µs}
# spent 4µs making 1 call to Foswiki::BEGIN@8.122
14
151100nsour $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
sub QUERY {
181600ns my ( $this, $params, $topicObject ) = @_;
191200ns my $result;
201500ns my $expr = $params->{_DEFAULT};
211200ns $expr = '' unless defined $expr;
2211µs my $style = ucfirst( lc( $params->{style} || 'default' ) );
231900ns if ( $style =~ m/[^a-zA-Z0-9_]/ ) {
24 return "%RED%QUERY: invalid 'style' parameter passed%ENDCOLOR%";
25 }
2612µs14µs $style = Foswiki::Sandbox::untaintUnchecked($style);
# spent 4µs making 1 call to Foswiki::Sandbox::untaintUnchecked
27
281300ns 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
3413µs13µ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.
4916µs $this->{evaluatingEval} ||= {};
50
51 # Block after 5 levels.
521400ns if ( $this->{evaluatingEval}->{$expr}
53 && $this->{evaluatingEval}->{$expr} > 5 )
54 {
55 delete $this->{evaluatingEval}->{$expr};
56 return '';
57 }
581300ns unless ($evalParser) {
5911µs require Foswiki::Query::Parser;
6016µs1808µs $evalParser = new Foswiki::Query::Parser();
# spent 808µs making 1 call to Foswiki::Query::Parser::new
61 }
62
6311µ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
try {
6512µs1400µs my $node = $evalParser->parse($expr);
# spent 400µs making 1 call to Foswiki::Infix::Parser::parse
6612µs18µs $result = $node->evaluate( tom => $topicObject, data => $topicObject );
# spent 8µs making 1 call to Foswiki::Query::Node::evaluate
6718µs1388µ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
finally {
7614µs delete $this->{evaluatingEval}->{$expr};
77116µs48µ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
7914µs return $result;
80}
81
8212µs1;
83__END__