← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 19:05:14 2015
Reported on Fri Jul 31 19:08:10 2015

Filename/var/www/foswiki11/lib/Foswiki/Query/OP_ref.pm
StatementsExecuted 22 statements in 901µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
31156µs106µsFoswiki::Query::OP_ref::::newFoswiki::Query::OP_ref::new
11124µs42µsFoswiki::Query::OP_ref::::BEGIN@11Foswiki::Query::OP_ref::BEGIN@11
11117µs32µsFoswiki::Query::OP_ref::::BEGIN@73Foswiki::Query::OP_ref::BEGIN@73
11115µs33µsFoswiki::Query::OP_ref::::BEGIN@75Foswiki::Query::OP_ref::BEGIN@75
11114µs38µsFoswiki::Query::OP_ref::::BEGIN@17Foswiki::Query::OP_ref::BEGIN@17
11113µs21µsFoswiki::Query::OP_ref::::BEGIN@12Foswiki::Query::OP_ref::BEGIN@12
11113µs166µsFoswiki::Query::OP_ref::::BEGIN@16Foswiki::Query::OP_ref::BEGIN@16
1116µs6µ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
11241µs261µs
# spent 42µs (24+19) within Foswiki::Query::OP_ref::BEGIN@11 which was called: # once (24µs+19µs) by Foswiki::Query::Parser::new at line 11
use strict;
# spent 42µs making 1 call to Foswiki::Query::OP_ref::BEGIN@11 # spent 19µs making 1 call to strict::import
12234µs229µs
# spent 21µs (13+8) within Foswiki::Query::OP_ref::BEGIN@12 which was called: # once (13µs+8µs) by Foswiki::Query::Parser::new at line 12
use warnings;
# spent 21µs making 1 call to Foswiki::Query::OP_ref::BEGIN@12 # spent 8µs making 1 call to warnings::import
13271µs16µs
# spent 6µs within Foswiki::Query::OP_ref::BEGIN@13 which was called: # once (6µs+0s) by Foswiki::Query::Parser::new at line 13
use Foswiki::Query::BinaryOP ();
# spent 6µs making 1 call to Foswiki::Query::OP_ref::BEGIN@13
14110µsour @ISA = ('Foswiki::Query::BinaryOP');
15
16244µs2320µs
# spent 166µs (13+153) within Foswiki::Query::OP_ref::BEGIN@16 which was called: # once (13µs+153µs) by Foswiki::Query::Parser::new at line 16
use Error qw( :try );
# spent 166µs making 1 call to Foswiki::Query::OP_ref::BEGIN@16 # spent 153µs making 1 call to Error::import
172505µs262µs
# spent 38µs (14+24) within Foswiki::Query::OP_ref::BEGIN@17 which was called: # once (14µs+24µs) by Foswiki::Query::Parser::new at line 17
use Assert;
# spent 38µs making 1 call to Foswiki::Query::OP_ref::BEGIN@17 # spent 24µs making 1 call to Assert::import
18
19
# spent 106µs (56+50) within Foswiki::Query::OP_ref::new which was called 3 times, avg 35µs/call: # 3 times (56µs+50µs) by Foswiki::Query::Parser::new at line 47 of /var/www/foswiki11/lib/Foswiki/Query/Parser.pm, avg 35µs/call
sub new {
2034µs my $class = shift;
21343µs350µs return $class->SUPER::new( name => '/', prec => 800 );
# spent 50µs making 3 calls to Foswiki::Query::BinaryOP::new, avg 17µ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::Simple 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;
73270µs247µs
# spent 32µs (17+15) within Foswiki::Query::OP_ref::BEGIN@73 which was called: # once (17µs+15µs) by Foswiki::Query::Parser::new at line 73
no warnings 'recursion';
# spent 32µs making 1 call to Foswiki::Query::OP_ref::BEGIN@73 # spent 15µs making 1 call to warnings::unimport
74 return 1 if $node->{params}[0]->evaluatesToConstant(@_);
75274µs251µs
# spent 33µs (15+18) within Foswiki::Query::OP_ref::BEGIN@75 which was called: # once (15µs+18µs) by Foswiki::Query::Parser::new at line 75
use warnings 'recursion';
# spent 33µs making 1 call to Foswiki::Query::OP_ref::BEGIN@75 # spent 18µs making 1 call to warnings::import
76
77 # param[1] may contain non-constant terms, but that's OK because
78 # they are evaluated relative to the (constant) param[0]
79 return 0;
80}
81
8214µs1;
83__END__