← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 18:42:36 2015
Reported on Fri Jul 31 18:48:14 2015

Filename/var/www/foswikidev/core/lib/Foswiki/Prefs/BaseBackend.pm
StatementsExecuted 3454 statements in 2.97ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
476221.79ms1.79msFoswiki::Prefs::BaseBackend::::cleanupInsertValueFoswiki::Prefs::BaseBackend::cleanupInsertValue
3822108µs108µsFoswiki::Prefs::BaseBackend::::newFoswiki::Prefs::BaseBackend::new
11112µs26µsFoswiki::Prefs::BaseBackend::::BEGIN@14Foswiki::Prefs::BaseBackend::BEGIN@14
1119µs36µsFoswiki::Prefs::BaseBackend::::BEGIN@16Foswiki::Prefs::BaseBackend::BEGIN@16
1119µs13µsFoswiki::Prefs::BaseBackend::::BEGIN@15Foswiki::Prefs::BaseBackend::BEGIN@15
1114µs4µsFoswiki::Prefs::BaseBackend::::BEGIN@18Foswiki::Prefs::BaseBackend::BEGIN@18
0000s0sFoswiki::Prefs::BaseBackend::::finishFoswiki::Prefs::BaseBackend::finish
0000s0sFoswiki::Prefs::BaseBackend::::getFoswiki::Prefs::BaseBackend::get
0000s0sFoswiki::Prefs::BaseBackend::::getLocalFoswiki::Prefs::BaseBackend::getLocal
0000s0sFoswiki::Prefs::BaseBackend::::insertFoswiki::Prefs::BaseBackend::insert
0000s0sFoswiki::Prefs::BaseBackend::::localPrefsFoswiki::Prefs::BaseBackend::localPrefs
0000s0sFoswiki::Prefs::BaseBackend::::prefsFoswiki::Prefs::BaseBackend::prefs
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::Prefs::BaseBackend
6
7This is the base module for preferences backends. Its main purpose is to
8document the interface and provide facilities methods.
9
10=cut
11
12package Foswiki::Prefs::BaseBackend;
13
14225µs241µs
# spent 26µs (12+14) within Foswiki::Prefs::BaseBackend::BEGIN@14 which was called: # once (12µs+14µs) by Foswiki::Prefs::HASH::BEGIN@20 at line 14
use strict;
# spent 26µs making 1 call to Foswiki::Prefs::BaseBackend::BEGIN@14 # spent 14µs making 1 call to strict::import
15226µs217µs
# spent 13µs (9+4) within Foswiki::Prefs::BaseBackend::BEGIN@15 which was called: # once (9µs+4µs) by Foswiki::Prefs::HASH::BEGIN@20 at line 15
use warnings;
# spent 13µs making 1 call to Foswiki::Prefs::BaseBackend::BEGIN@15 # spent 4µs making 1 call to warnings::import
16252µs263µs
# spent 36µs (9+27) within Foswiki::Prefs::BaseBackend::BEGIN@16 which was called: # once (9µs+27µs) by Foswiki::Prefs::HASH::BEGIN@20 at line 16
use Assert;
# spent 36µs making 1 call to Foswiki::Prefs::BaseBackend::BEGIN@16 # spent 27µs making 1 call to Exporter::import
17
18
# spent 4µs within Foswiki::Prefs::BaseBackend::BEGIN@18 which was called: # once (4µs+0s) by Foswiki::Prefs::HASH::BEGIN@20 at line 23
BEGIN {
1917µs if ( $Foswiki::cfg{UseLocale} ) {
20 require locale;
21 import locale();
22 }
231256µs14µs}
# spent 4µs making 1 call to Foswiki::Prefs::BaseBackend::BEGIN@18
24
25=begin TML
26
27---++ ClassMethod new(@_)
28
29Creates a preferences backend object.
30
31=cut
32
33
# spent 108µs within Foswiki::Prefs::BaseBackend::new which was called 38 times, avg 3µs/call: # 29 times (76µs+0s) by Foswiki::Prefs::TopicRAM::new at line 34 of /var/www/foswikidev/core/lib/Foswiki/Prefs/TopicRAM.pm, avg 3µs/call # 9 times (32µs+0s) by Foswiki::Prefs::HASH::new at line 33 of /var/www/foswikidev/core/lib/Foswiki/Prefs/HASH.pm, avg 4µs/call
sub new {
343817µs my ( $proto, $values ) = @_;
353813µs my $class = ref($proto) || $proto;
36
3738128µs return bless {}, $class;
38}
39
40=begin TML
41
42---++ ObjectMethod finish()
43Break circular references.
44
45=cut
46
47# Note to developers; please undef *all* fields in the object explicitly,
48# whether they are references or not. That way this method is "golden
49# documentation" of the live fields in the object.
50sub finish { }
51
52=begin TML
53
54---++ ObjectMethod prefs() -> @preferenceKeys
55
56Return a list with the names of defined preferences.
57
58=cut
59
60sub prefs {
61 ASSERT('Pure virtual method - child classes must redefine');
62}
63
64=begin TML
65
66---++ ObjectMethod localPrefs() -> @preferenceKeys
67
68Return a list with the names of 'Local' preferences.
69
70=cut
71
72sub localPrefs {
73 ASSERT('Pure virtual method - child classes must redefine');
74}
75
76=begin TML
77
78---++ ObjectMethod get($key) -> $value
79
80Return the value of the preference $key.
81
82=cut
83
84sub get {
85 ASSERT('Pure virtual method - child classes must redefine');
86}
87
88=begin TML
89
90---++ ObjectMethod getLocal($key) -> $value
91
92Return the 'Local' value of the preference $key.
93
94=cut
95
96sub getLocal {
97 ASSERT('Pure virtual method - child classes must redefine');
98}
99
100=begin TML
101
102---++ ObjectMethod insert($type, $key, $value ) = @_;
103
104Insert the preference named $key as $value. $type can be 'Local' or 'Set'.
105
106=cut
107
108sub insert {
109 ASSERT('Pure virtual method - child classes must redefine');
110}
111
112=begin TML
113
114---++ ObjectMethod cleanupInsertValue($value_ref)
115
116Utility method that cleans $$vaue_ref for later use in insert().
117
118=cut
119
120
# spent 1.79ms within Foswiki::Prefs::BaseBackend::cleanupInsertValue which was called 476 times, avg 4µs/call: # 414 times (1.60ms+0s) by Foswiki::Prefs::TopicRAM::insert at line 89 of /var/www/foswikidev/core/lib/Foswiki/Prefs/TopicRAM.pm, avg 4µs/call # 62 times (188µs+0s) by Foswiki::Prefs::HASH::insert at line 64 of /var/www/foswikidev/core/lib/Foswiki/Prefs/HASH.pm, avg 3µs/call
sub cleanupInsertValue {
121476133µs my ( $this, $value_ref ) = @_;
122
12347691µs return unless defined $$value_ref;
124
125476407µs $$value_ref =~ tr/\r//d; # Delete \r
126476274µs $$value_ref =~ tr/\t/ /; # replace TAB by space
127476200µs $$value_ref =~ s/([^\\])\\n/$1\n/g; # replace \n by new line
128476124µs $$value_ref =~ s/([^\\])\\\\n/$1\\n/g; # replace \\n by \n
1294761.22ms $$value_ref =~ tr/`//d; # filter out dangerous chars
130}
131
13212µs1;
133__END__