Filename | /var/www/foswikidev/core/lib/Foswiki/If/OP_defined.pm |
Statements | Executed 175 statements in 462µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
13 | 1 | 1 | 233µs | 1.18ms | evaluate | Foswiki::If::OP_defined::
1 | 1 | 1 | 17µs | 30µs | BEGIN@11 | Foswiki::If::OP_defined::
1 | 1 | 1 | 16µs | 29µs | new | Foswiki::If::OP_defined::
1 | 1 | 1 | 12µs | 15µs | BEGIN@12 | Foswiki::If::OP_defined::
1 | 1 | 1 | 6µs | 6µs | BEGIN@17 | Foswiki::If::OP_defined::
1 | 1 | 1 | 4µs | 4µ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 | 26µs | 2 | 42µs | # spent 30µs (17+12) within Foswiki::If::OP_defined::BEGIN@11 which was called:
# once (17µs+12µs) by Foswiki::If::Parser::BEGIN@24 at line 11 # spent 30µs making 1 call to Foswiki::If::OP_defined::BEGIN@11
# spent 12µs making 1 call to strict::import |
12 | 2 | 23µs | 2 | 19µs | # spent 15µs (12+4) within Foswiki::If::OP_defined::BEGIN@12 which was called:
# once (12µs+4µs) by Foswiki::If::Parser::BEGIN@24 at line 12 # spent 15µs making 1 call to Foswiki::If::OP_defined::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | |||||
14 | 2 | 53µs | 1 | 4µs | # spent 4µs within Foswiki::If::OP_defined::BEGIN@14 which was called:
# once (4µs+0s) by Foswiki::If::Parser::BEGIN@24 at line 14 # spent 4µs making 1 call to Foswiki::If::OP_defined::BEGIN@14 |
15 | 1 | 6µs | our @ISA = ('Foswiki::Query::UnaryOP'); | ||
16 | |||||
17 | # spent 6µs within Foswiki::If::OP_defined::BEGIN@17 which was called:
# once (6µs+0s) by Foswiki::If::Parser::BEGIN@24 at line 22 | ||||
18 | 1 | 4µs | if ( $Foswiki::cfg{UseLocale} ) { | ||
19 | require locale; | ||||
20 | import locale(); | ||||
21 | } | ||||
22 | 1 | 150µs | 1 | 6µs | } # spent 6µs making 1 call to Foswiki::If::OP_defined::BEGIN@17 |
23 | |||||
24 | # spent 29µs (16+14) within Foswiki::If::OP_defined::new which was called:
# once (16µs+14µs) by Foswiki::If::Parser::new at line 49 of /var/www/foswikidev/core/lib/Foswiki/If/Parser.pm | ||||
25 | 1 | 400ns | my $class = shift; | ||
26 | 1 | 15µs | 1 | 14µs | return $class->SUPER::new( name => 'defined', prec => 600 ); # spent 14µs making 1 call to Foswiki::Query::UnaryOP::new |
27 | } | ||||
28 | |||||
29 | # spent 1.18ms (233µs+944µs) within Foswiki::If::OP_defined::evaluate which was called 13 times, avg 91µs/call:
# 13 times (233µs+944µs) by Foswiki::Query::Node::evaluate at line 223 of /var/www/foswikidev/core/lib/Foswiki/Query/Node.pm, avg 91µs/call | ||||
30 | 13 | 3µs | my $this = shift; | ||
31 | 13 | 2µs | my $node = shift; | ||
32 | 13 | 6µs | my $a = $node->{params}[0]; | ||
33 | 13 | 10µs | my %domain = @_; | ||
34 | 13 | 18µs | 13 | 16µs | my $session = $domain{tom}->session; # spent 16µs making 13 calls to Foswiki::Meta::session, avg 1µs/call |
35 | 13 | 3µs | throw Error::Simple( | ||
36 | 'No context in which to evaluate "' . $a->stringify() . '"' ) | ||||
37 | unless $session; | ||||
38 | |||||
39 | # NOTE: If::Node::_evaluate(), not Query::Node::evaluate | ||||
40 | 13 | 21µs | 13 | 25µs | my $eval = $a->_evaluate(@_); # spent 25µs making 13 calls to Foswiki::If::Node::_evaluate, avg 2µs/call |
41 | |||||
42 | #print STDERR "Evaluate ".$node->stringify()." -> ".(defined $eval ? $eval : 'undef')."\n"; | ||||
43 | 13 | 2µs | return 0 unless $eval; | ||
44 | 13 | 24µs | 13 | 223µs | return 1 if ( defined( $session->{request}->param($eval) ) ); # spent 223µs making 13 calls to Foswiki::Request::param, avg 17µs/call |
45 | 13 | 24µs | 13 | 400µs | return 1 if ( defined( $domain{tom}->getPreference($eval) ) ); # spent 400µs making 13 calls to Foswiki::Meta::getPreference, avg 31µs/call |
46 | 13 | 31µs | 13 | 280µs | return 1 if ( defined( $session->{prefs}->getPreference($eval) ) ); # spent 280µs making 13 calls to Foswiki::Prefs::getPreference, avg 22µs/call |
47 | 11 | 8µs | return 1 if ( exists( $Foswiki::macros{$eval} ) ); | ||
48 | 10 | 27µs | return 0; | ||
49 | } | ||||
50 | |||||
51 | 1 | 3µs | 1; | ||
52 | __END__ |