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

Filename/var/www/foswiki11/lib/Foswiki/WebFilter.pm
StatementsExecuted 1006 statements in 4.17ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
100114.03ms8.26sFoswiki::WebFilter::::okFoswiki::WebFilter::ok
542233µs233µsFoswiki::WebFilter::::newFoswiki::WebFilter::new
11112µs26µsFoswiki::WebFilter::::BEGIN@4Foswiki::WebFilter::BEGIN@4
1119µs14µsFoswiki::WebFilter::::BEGIN@5Foswiki::WebFilter::BEGIN@5
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::WebFilter;
3
4227µs239µs
# spent 26µs (12+13) within Foswiki::WebFilter::BEGIN@4 which was called: # once (12µs+13µs) by Foswiki::Search::BEGIN@23 at line 4
use strict;
# spent 26µs making 1 call to Foswiki::WebFilter::BEGIN@4 # spent 13µs making 1 call to strict::import
52246µs219µs
# spent 14µs (9+5) within Foswiki::WebFilter::BEGIN@5 which was called: # once (9µs+5µs) by Foswiki::Search::BEGIN@23 at line 5
use warnings;
# spent 14µs making 1 call to Foswiki::WebFilter::BEGIN@5 # spent 5µs making 1 call to warnings::import
6
7#TODO: documentme
8#TODO: should this be converted to a FilterIterator?
9
10# spec in the $filter,
11# which may include one of:
12# 1 'user' (for only user webs)
13# 2 'template' (for only template webs)
14# $filter may also contain the word 'public' which will further filter
15# webs on whether NOSEARCHALL is specified for them or not.
16# 'allowed' filters out webs that the user is denied access to by a *WEBVIEW.
17
18
# spent 233µs within Foswiki::WebFilter::new which was called 5 times, avg 47µs/call: # 2 times (160µs+0s) by Foswiki::Func::getListOfWebs at line 1476 of /var/www/foswiki11/lib/Foswiki/Func.pm, avg 80µs/call # once (34µs+0s) by Foswiki::Search::BEGIN@23 at line 52 # once (20µs+0s) by Foswiki::Search::BEGIN@23 at line 54 # once (20µs+0s) by Foswiki::Search::BEGIN@23 at line 53
sub new {
19510µs my ( $class, $filter ) = @_;
20516µs my $this = bless( {}, $class );
2158µs foreach my $f (qw(user template public allowed)) {
2220183µs $this->{$f} = ( $filter =~ /\b$f\b/ );
23 }
24527µs return $this;
25}
26
27
# spent 8.26s (4.03ms+8.25) within Foswiki::WebFilter::ok which was called 100 times, avg 82.6ms/call: # 100 times (4.03ms+8.25s) by Foswiki::deepWebList at line 1575 of /var/www/foswiki11/lib/Foswiki.pm, avg 82.6ms/call
sub ok {
28100101µs my ( $this, $session, $web ) = @_;
29
3010061µs return 0 if $this->{template} && $web !~ /(?:^_|\/_)/;
31
3210085µs return 1 if ( $web eq $session->{webName} );
33
3498486µs return 0 if $this->{user} && $web =~ /(?:^_|\/_)/;
35
3695273µs9510.0ms return 0 if !$session->webExists($web);
# spent 10.0ms making 95 calls to Foswiki::webExists, avg 105µs/call
37
3894539µs942.71ms my $webObject = Foswiki::Meta->new( $session, $web );
# spent 2.71ms making 94 calls to Foswiki::Meta::new, avg 29µs/call
3994516µs1887.94s my $thisWebNoSearchAll =
# spent 7.94s making 94 calls to Foswiki::Meta::getPreference, avg 84.5ms/call # spent 1.46ms making 94 calls to Foswiki::isTrue, avg 16µs/call
40 Foswiki::isTrue( $webObject->getPreference('NOSEARCHALL') );
41
4294555µs94520µs return 0
# spent 520µs making 94 calls to Foswiki::Users::isAdmin, avg 6µs/call
43 if $this->{public}
44 && !$session->{users}->isAdmin( $session->{user} )
45 && $thisWebNoSearchAll;
46
4793334µs93296ms return 0 if $this->{allowed} && !$webObject->haveAccess('VIEW');
# spent 296ms making 93 calls to Foswiki::Meta::haveAccess, avg 3.18ms/call
48
4990689µs return 1;
50}
51
5213µs134µsour $public = new Foswiki::WebFilter('public');
# spent 34µs making 1 call to Foswiki::WebFilter::new
5313µs120µsour $user = new Foswiki::WebFilter('user');
# spent 20µs making 1 call to Foswiki::WebFilter::new
5412µs120µsour $user_allowed = new Foswiki::WebFilter('user,allowed');
# spent 20µs making 1 call to Foswiki::WebFilter::new
55
5614µs1;
57__END__