Filename | /usr/local/src/github.com/foswiki/core/lib/Foswiki/If/OP_defined.pm |
Statements | Executed 136 statements in 971µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
10 | 1 | 1 | 590µs | 2.29ms | evaluate | Foswiki::If::OP_defined::
1 | 1 | 1 | 33µs | 62µs | new | Foswiki::If::OP_defined::
1 | 1 | 1 | 24µs | 32µs | BEGIN@11 | Foswiki::If::OP_defined::
1 | 1 | 1 | 17µs | 35µs | BEGIN@12 | Foswiki::If::OP_defined::
1 | 1 | 1 | 9µs | 9µs | BEGIN@14 | Foswiki::If::OP_defined::
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::If::OP_defined | ||||
6 | |||||
7 | =cut | ||||
8 | |||||
9 | package Foswiki::If::OP_defined; | ||||
10 | |||||
11 | 2 | 51µs | 2 | 39µs | # spent 32µs (24+7) within Foswiki::If::OP_defined::BEGIN@11 which was called:
# once (24µs+7µs) by Foswiki::If::Parser::BEGIN@24 at line 11 # spent 32µs making 1 call to Foswiki::If::OP_defined::BEGIN@11
# spent 7µs making 1 call to strict::import |
12 | 2 | 44µs | 2 | 52µs | # spent 35µs (17+18) within Foswiki::If::OP_defined::BEGIN@12 which was called:
# once (17µs+18µs) by Foswiki::If::Parser::BEGIN@24 at line 12 # spent 35µs making 1 call to Foswiki::If::OP_defined::BEGIN@12
# spent 18µs making 1 call to warnings::import |
13 | |||||
14 | 2 | 295µs | 1 | 9µs | # spent 9µs within Foswiki::If::OP_defined::BEGIN@14 which was called:
# once (9µs+0s) by Foswiki::If::Parser::BEGIN@24 at line 14 # spent 9µs making 1 call to Foswiki::If::OP_defined::BEGIN@14 |
15 | 1 | 9µs | our @ISA = ('Foswiki::Query::UnaryOP'); | ||
16 | |||||
17 | # spent 62µs (33+29) within Foswiki::If::OP_defined::new which was called:
# once (33µs+29µs) by Foswiki::If::Parser::new at line 42 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/If/Parser.pm | ||||
18 | 2 | 28µs | my $class = shift; | ||
19 | 1 | 29µs | return $class->SUPER::new( name => 'defined', prec => 600 ); # spent 29µs making 1 call to Foswiki::Query::UnaryOP::new | ||
20 | } | ||||
21 | |||||
22 | # spent 2.29ms (590µs+1.70) within Foswiki::If::OP_defined::evaluate which was called 10 times, avg 229µs/call:
# 10 times (590µs+1.70ms) by Foswiki::Query::Node::evaluate at line 223 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Query/Node.pm, avg 229µs/call | ||||
23 | 126 | 539µs | my $this = shift; | ||
24 | my $node = shift; | ||||
25 | my $a = $node->{params}[0]; | ||||
26 | my %domain = @_; | ||||
27 | 10 | 51µs | my $session = $domain{tom}->session; # spent 51µs making 10 calls to Foswiki::Meta::session, avg 5µs/call | ||
28 | throw Error::Simple( | ||||
29 | 'No context in which to evaluate "' . $a->stringify() . '"' ) | ||||
30 | unless $session; | ||||
31 | |||||
32 | # NOTE: If::Node::_evaluate(), not Query::Node::evaluate | ||||
33 | 10 | 93µs | my $eval = $a->_evaluate(@_); # spent 93µs making 10 calls to Foswiki::If::Node::_evaluate, avg 9µs/call | ||
34 | |||||
35 | #print STDERR "Evaluate ".$node->stringify()." -> ".(defined $eval ? $eval : 'undef')."\n"; | ||||
36 | return 0 unless $eval; | ||||
37 | 10 | 594µs | return 1 if ( defined( $session->{request}->param($eval) ) ); # spent 594µs making 10 calls to Foswiki::Request::param, avg 59µs/call | ||
38 | 10 | 243µs | return 1 if ( defined( $domain{tom}->getPreference($eval) ) ); # spent 243µs making 10 calls to Foswiki::Meta::getPreference, avg 24µs/call | ||
39 | 10 | 718µs | return 1 if ( defined( $session->{prefs}->getPreference($eval) ) ); # spent 718µs making 10 calls to Foswiki::Prefs::getPreference, avg 72µs/call | ||
40 | return 1 if ( exists( $Foswiki::macros{$eval} ) ); | ||||
41 | return 0; | ||||
42 | } | ||||
43 | |||||
44 | 1 | 6µs | 1; | ||
45 | __END__ |