Filename | /var/www/foswiki11/lib/Foswiki/Prefs/Web.pm |
Statements | Executed 2744 statements in 5.93ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
861 | 1 | 1 | 7.60ms | 28.8ms | get | Foswiki::Prefs::Web::
92 | 1 | 1 | 797µs | 797µs | new | Foswiki::Prefs::Web::
92 | 1 | 1 | 683µs | 1.51ms | finish | Foswiki::Prefs::Web::
51 | 1 | 1 | 376µs | 478µs | isInTopOfStack | Foswiki::Prefs::Web::
36 | 1 | 1 | 209µs | 4.12ms | cloneStack | Foswiki::Prefs::Web::
15 | 1 | 1 | 45µs | 45µs | stack | Foswiki::Prefs::Web::
1 | 1 | 1 | 14µs | 28µs | BEGIN@18 | Foswiki::Prefs::Web::
1 | 1 | 1 | 9µs | 15µs | BEGIN@19 | Foswiki::Prefs::Web::
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 | ---+ UNPUBLISHED package Foswiki::Prefs::Web | ||||
6 | |||||
7 | This class is a simple wrapper around Foswiki::Prefs::Stack. Since Webs has an | ||||
8 | hierarchical structure it's needed only one stack to deal with preferences from | ||||
9 | Web and Web/Subweb and Web/Subweb/Subsubweb. This class has a reference to a | ||||
10 | stack and the level where the web is. | ||||
11 | |||||
12 | This class is used by Foswiki::Prefs to pass web preferences to Foswiki::Meta | ||||
13 | and should not be used for anything else. | ||||
14 | |||||
15 | =cut | ||||
16 | |||||
17 | package Foswiki::Prefs::Web; | ||||
18 | 2 | 28µs | 2 | 42µs | # spent 28µs (14+14) within Foswiki::Prefs::Web::BEGIN@18 which was called:
# once (14µs+14µs) by Foswiki::Prefs::BEGIN@71 at line 18 # spent 28µs making 1 call to Foswiki::Prefs::Web::BEGIN@18
# spent 14µs making 1 call to strict::import |
19 | 2 | 281µs | 2 | 20µs | # spent 15µs (9+6) within Foswiki::Prefs::Web::BEGIN@19 which was called:
# once (9µs+6µs) by Foswiki::Prefs::BEGIN@71 at line 19 # spent 15µs making 1 call to Foswiki::Prefs::Web::BEGIN@19
# spent 6µs making 1 call to warnings::import |
20 | |||||
21 | =begin TML | ||||
22 | |||||
23 | ---++ ClassMethod new( $session ) | ||||
24 | |||||
25 | Creates a new WebPrefs object. | ||||
26 | |||||
27 | =cut | ||||
28 | |||||
29 | # spent 797µs within Foswiki::Prefs::Web::new which was called 92 times, avg 9µs/call:
# 92 times (797µs+0s) by Foswiki::Prefs::_getWebPrefsObj at line 205 of /var/www/foswiki11/lib/Foswiki/Prefs.pm, avg 9µs/call | ||||
30 | 92 | 55µs | my $proto = shift; | ||
31 | 92 | 66µs | my $class = ref($proto) || $proto; | ||
32 | 92 | 76µs | my ( $stack, $level ) = @_; | ||
33 | 92 | 221µs | my $this = { | ||
34 | stack => $stack, | ||||
35 | level => $level, | ||||
36 | }; | ||||
37 | 92 | 494µs | return bless $this, $class; | ||
38 | } | ||||
39 | |||||
40 | =begin TML | ||||
41 | |||||
42 | ---++ ObjectMethod finish() | ||||
43 | |||||
44 | Break circular references. | ||||
45 | |||||
46 | =cut | ||||
47 | |||||
48 | # Note to developers; please undef *all* fields in the object explicitly, | ||||
49 | # whether they are references or not. That way this method is "golden | ||||
50 | # documentation" of the live fields in the object. | ||||
51 | # spent 1.51ms (683µs+830µs) within Foswiki::Prefs::Web::finish which was called 92 times, avg 16µs/call:
# 92 times (683µs+830µs) by Foswiki::Prefs::finish at line 128 of /var/www/foswiki11/lib/Foswiki/Prefs.pm, avg 16µs/call | ||||
52 | 92 | 21µs | my $this = shift; | ||
53 | 92 | 413µs | 92 | 830µs | $this->{stack}->finish() if $this->{stack}; # spent 830µs making 92 calls to Foswiki::Prefs::Stack::finish, avg 9µs/call |
54 | 92 | 50µs | undef $this->{stack}; | ||
55 | 92 | 164µs | undef $this->{level}; | ||
56 | } | ||||
57 | |||||
58 | =begin TML | ||||
59 | |||||
60 | ---++ ObjectMethod isInTopOfStack() -> $boolean | ||||
61 | |||||
62 | Returns true if this web is the hihger of the underlying stack object. | ||||
63 | |||||
64 | =cut | ||||
65 | |||||
66 | # spent 478µs (376+102) within Foswiki::Prefs::Web::isInTopOfStack which was called 51 times, avg 9µs/call:
# 51 times (376µs+102µs) by Foswiki::Prefs::_getWebPrefsObj at line 190 of /var/www/foswiki11/lib/Foswiki/Prefs.pm, avg 9µs/call | ||||
67 | 51 | 17µs | my $this = shift; | ||
68 | 51 | 305µs | 51 | 102µs | return $this->{level} == $this->{stack}->size() - 1; # spent 102µs making 51 calls to Foswiki::Prefs::Stack::size, avg 2µs/call |
69 | } | ||||
70 | |||||
71 | =begin TML | ||||
72 | |||||
73 | ---++ ObjectMethod stack() -> $stack | ||||
74 | |||||
75 | Read-only accessor to the underlying stack object. | ||||
76 | |||||
77 | =cut | ||||
78 | |||||
79 | # spent 45µs within Foswiki::Prefs::Web::stack which was called 15 times, avg 3µs/call:
# 15 times (45µs+0s) by Foswiki::Prefs::_getWebPrefsObj at line 190 of /var/www/foswiki11/lib/Foswiki/Prefs.pm, avg 3µs/call | ||||
80 | 15 | 66µs | return $_[0]->{stack}; | ||
81 | } | ||||
82 | |||||
83 | =begin TML | ||||
84 | |||||
85 | ---++ ObjectMethod cloneStack($level) -> $stack | ||||
86 | |||||
87 | This method clone the underlying stack object, to the given $level. See | ||||
88 | Foswiki::Prefs::Stack::clone documentation. | ||||
89 | |||||
90 | This method exists because WebPrefs objects are used by Foswiki::Prefs instead | ||||
91 | of bar Foswiki::Prefs::Stack and this operation is needed. | ||||
92 | |||||
93 | =cut | ||||
94 | |||||
95 | # spent 4.12ms (209µs+3.91) within Foswiki::Prefs::Web::cloneStack which was called 36 times, avg 114µs/call:
# 36 times (209µs+3.91ms) by Foswiki::Prefs::_getWebPrefsObj at line 190 of /var/www/foswiki11/lib/Foswiki/Prefs.pm, avg 114µs/call | ||||
96 | 36 | 23µs | my ( $this, $level ) = @_; | ||
97 | 36 | 168µs | 36 | 3.91ms | return $this->{stack}->clone($level); # spent 3.91ms making 36 calls to Foswiki::Prefs::Stack::clone, avg 109µs/call |
98 | } | ||||
99 | |||||
100 | =begin TML | ||||
101 | |||||
102 | ---++ ObjectMethod get($pref) -> $value | ||||
103 | |||||
104 | Returns the $value of the given $pref. | ||||
105 | |||||
106 | =cut | ||||
107 | |||||
108 | # spent 28.8ms (7.60+21.2) within Foswiki::Prefs::Web::get which was called 861 times, avg 33µs/call:
# 861 times (7.60ms+21.2ms) by Foswiki::Meta::getPreference at line 596 of /var/www/foswiki11/lib/Foswiki/Meta.pm, avg 33µs/call | ||||
109 | 861 | 502µs | my ( $this, $key ) = @_; | ||
110 | 861 | 2.98ms | 861 | 21.2ms | $this->{stack}->getPreference( $key, $this->{level} ); # spent 21.2ms making 861 calls to Foswiki::Prefs::Stack::getPreference, avg 25µs/call |
111 | } | ||||
112 | |||||
113 | 1 | 2µs | 1; | ||
114 | __END__ |