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

Filename/var/www/foswikidev/core/lib/Foswiki/Query/OP_ref.pm
StatementsExecuted 18 statements in 510µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
31134µs49µsFoswiki::Query::OP_ref::::newFoswiki::Query::OP_ref::new
11113µs25µsFoswiki::Query::OP_ref::::BEGIN@11Foswiki::Query::OP_ref::BEGIN@11
11110µs34µsFoswiki::Query::OP_ref::::BEGIN@17Foswiki::Query::OP_ref::BEGIN@17
11110µs14µsFoswiki::Query::OP_ref::::BEGIN@12Foswiki::Query::OP_ref::BEGIN@12
1118µs111µsFoswiki::Query::OP_ref::::BEGIN@16Foswiki::Query::OP_ref::BEGIN@16
1114µs4µsFoswiki::Query::OP_ref::::BEGIN@13Foswiki::Query::OP_ref::BEGIN@13
0000s0sFoswiki::Query::OP_ref::::__ANON__[:60]Foswiki::Query::OP_ref::__ANON__[:60]
0000s0sFoswiki::Query::OP_ref::::__ANON__[:63]Foswiki::Query::OP_ref::__ANON__[:63]
0000s0sFoswiki::Query::OP_ref::::evaluateFoswiki::Query::OP_ref::evaluate
0000s0sFoswiki::Query::OP_ref::::evaluatesToConstantFoswiki::Query::OP_ref::evaluatesToConstant
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
2
3=begin TML
4
5---+ package Foswiki::Query::OP_ref
6
7=cut
8
9package Foswiki::Query::OP_ref;
10
11229µs237µs
# spent 25µs (13+12) within Foswiki::Query::OP_ref::BEGIN@11 which was called: # once (13µs+12µs) by Foswiki::Query::Parser::BEGIN@58 at line 11
use strict;
# spent 25µs making 1 call to Foswiki::Query::OP_ref::BEGIN@11 # spent 12µs making 1 call to strict::import
12223µs218µs
# spent 14µs (10+4) within Foswiki::Query::OP_ref::BEGIN@12 which was called: # once (10µs+4µs) by Foswiki::Query::Parser::BEGIN@58 at line 12
use warnings;
# spent 14µs making 1 call to Foswiki::Query::OP_ref::BEGIN@12 # spent 4µs making 1 call to warnings::import
13233µs14µs
# spent 4µs within Foswiki::Query::OP_ref::BEGIN@13 which was called: # once (4µs+0s) by Foswiki::Query::Parser::BEGIN@58 at line 13
use Foswiki::Query::OP ();
# spent 4µs making 1 call to Foswiki::Query::OP_ref::BEGIN@13
1416µsour @ISA = ('Foswiki::Query::OP');
15
16229µs2214µs
# spent 111µs (8+103) within Foswiki::Query::OP_ref::BEGIN@16 which was called: # once (8µs+103µs) by Foswiki::Query::Parser::BEGIN@58 at line 16
use Error qw( :try );
# spent 111µs making 1 call to Foswiki::Query::OP_ref::BEGIN@16 # spent 103µs making 1 call to Error::import
172355µs258µs
# spent 34µs (10+24) within Foswiki::Query::OP_ref::BEGIN@17 which was called: # once (10µs+24µs) by Foswiki::Query::Parser::BEGIN@58 at line 17
use Assert;
# spent 34µs making 1 call to Foswiki::Query::OP_ref::BEGIN@17 # spent 24µs making 1 call to Exporter::import
18
19
# spent 49µs (34+14) within Foswiki::Query::OP_ref::new which was called 3 times, avg 16µs/call: # 3 times (34µs+14µs) by Foswiki::Query::Parser::new at line 112 of /var/www/foswikidev/core/lib/Foswiki/Query/Parser.pm, avg 16µs/call
sub new {
2031µs my $class = shift;
21330µs314µs return $class->SUPER::new( arity => 2, name => '/', prec => 800 );
# spent 14µs making 3 calls to Foswiki::Query::OP::new, avg 5µs/call
22}
23
24sub evaluate {
25 my $this = shift;
26 my $pnode = shift;
27 my %domain = @_;
28
29 eval "require $Foswiki::cfg{Store}{QueryAlgorithm}";
30 die $@ if $@;
31
32 my $a = $pnode->{params}[0];
33 my $node = $a->evaluate(@_);
34 return unless defined $node;
35 if ( ref($node) eq 'HASH' ) {
36 return;
37 }
38 if ( !( ref($node) eq 'ARRAY' ) ) {
39 $node = [$node];
40 }
41 my @result;
42 foreach my $v (@$node) {
43
44 # Has to be relative to the web of the topic we are querying
45 my ( $w, $t ) =
46 $Foswiki::Plugins::SESSION->normalizeWebTopicName(
47 $Foswiki::Plugins::SESSION->{webName}, $v );
48 try {
49 my $submeta =
50 $Foswiki::cfg{Store}{QueryAlgorithm}
51 ->getRefTopic( $domain{tom}, $w, $t );
52 my $b = $pnode->{params}[1];
53 my $res = $b->evaluate( tom => $submeta, data => $submeta );
54 if ( ref($res) eq 'ARRAY' ) {
55 push( @result, @$res );
56 }
57 else {
58 push( @result, $res );
59 }
60 }
61 catch Error with {
62 print STDERR "ERROR IN OP_ref: $_[0]->{-text}" if DEBUG;
63 };
64 }
65 return unless scalar(@result);
66 return $result[0] if scalar(@result) == 1;
67 return \@result;
68}
69
70sub evaluatesToConstant {
71 my $this = shift;
72 my $node = shift;
73 return 1 if $node->{params}[0]->evaluatesToConstant(@_);
74
75 # param[1] may contain non-constant terms, but that's OK because
76 # they are evaluated relative to the (constant) param[0]
77 return 0;
78}
79
8013µs1;
81__END__