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

Filename/var/www/foswiki11/lib/Foswiki/Prefs/BaseBackend.pm
StatementsExecuted 13251 statements in 13.3ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1745227.08ms7.08msFoswiki::Prefs::BaseBackend::::cleanupInsertValueFoswiki::Prefs::BaseBackend::cleanupInsertValue
343221.17ms1.17msFoswiki::Prefs::BaseBackend::::newFoswiki::Prefs::BaseBackend::new
11115µs28µsFoswiki::Prefs::BaseBackend::::BEGIN@14Foswiki::Prefs::BaseBackend::BEGIN@14
1119µs14µsFoswiki::Prefs::BaseBackend::::BEGIN@15Foswiki::Prefs::BaseBackend::BEGIN@15
1118µs21µsFoswiki::Prefs::BaseBackend::::BEGIN@16Foswiki::Prefs::BaseBackend::BEGIN@16
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
14226µs241µs
# spent 28µs (15+13) within Foswiki::Prefs::BaseBackend::BEGIN@14 which was called: # once (15µs+13µs) by Foswiki::Prefs::HASH::BEGIN@20 at line 14
use strict;
# spent 28µs making 1 call to Foswiki::Prefs::BaseBackend::BEGIN@14 # spent 13µs making 1 call to strict::import
15222µs219µs
# spent 14µs (9+5) within Foswiki::Prefs::BaseBackend::BEGIN@15 which was called: # once (9µs+5µs) by Foswiki::Prefs::HASH::BEGIN@20 at line 15
use warnings;
# spent 14µs making 1 call to Foswiki::Prefs::BaseBackend::BEGIN@15 # spent 5µs making 1 call to warnings::import
162268µs235µs
# spent 21µs (8+13) within Foswiki::Prefs::BaseBackend::BEGIN@16 which was called: # once (8µs+13µs) by Foswiki::Prefs::HASH::BEGIN@20 at line 16
use Assert;
# spent 21µs making 1 call to Foswiki::Prefs::BaseBackend::BEGIN@16 # spent 13µs making 1 call to Assert::import
17
18=begin TML
19
20---++ ClassMethod new(@_)
21
22Creates a preferences backend object.
23
24=cut
25
26
# spent 1.17ms within Foswiki::Prefs::BaseBackend::new which was called 343 times, avg 3µs/call: # 336 times (1.13ms+0s) by Foswiki::Prefs::TopicRAM::new at line 27 of /var/www/foswiki11/lib/Foswiki/Prefs/TopicRAM.pm, avg 3µs/call # 7 times (37µs+0s) by Foswiki::Prefs::HASH::new at line 26 of /var/www/foswiki11/lib/Foswiki/Prefs/HASH.pm, avg 5µs/call
sub new {
27343179µs my ( $proto, $values ) = @_;
28343164µs my $class = ref($proto) || $proto;
29
303431.34ms return bless {}, $class;
31}
32
33=begin TML
34
35---++ ObjectMethod finish()
36Break circular references.
37
38=cut
39
40# Note to developers; please undef *all* fields in the object explicitly,
41# whether they are references or not. That way this method is "golden
42# documentation" of the live fields in the object.
43sub finish { }
44
45=begin TML
46
47---++ ObjectMethod prefs() -> @preferenceKeys
48
49Return a list with the names of defined preferences.
50
51=cut
52
53sub prefs {
54 ASSERT('Pure virtual method - child classes must redefine');
55}
56
57=begin TML
58
59---++ ObjectMethod localPrefs() -> @preferenceKeys
60
61Return a list with the names of 'Local' preferences.
62
63=cut
64
65sub localPrefs {
66 ASSERT('Pure virtual method - child classes must redefine');
67}
68
69=begin TML
70
71---++ ObjectMethod get($key) -> $value
72
73Return the value of the preference $key.
74
75=cut
76
77sub get {
78 ASSERT('Pure virtual method - child classes must redefine');
79}
80
81=begin TML
82
83---++ ObjectMethod getLocal($key) -> $value
84
85Return the 'Local' value of the preference $key.
86
87=cut
88
89sub getLocal {
90 ASSERT('Pure virtual method - child classes must redefine');
91}
92
93=begin TML
94
95---++ ObjectMethod insert($type, $key, $value ) = @_;
96
97Insert the preference named $key as $value. $type can be 'Local' or 'Set'.
98
99=cut
100
101sub insert {
102 ASSERT('Pure virtual method - child classes must redefine');
103}
104
105=begin TML
106
107---++ ObjectMethod cleanupInsertValue($value_ref)
108
109Utility method that cleans $$vaue_ref for later use in insert().
110
111=cut
112
113
# spent 7.08ms within Foswiki::Prefs::BaseBackend::cleanupInsertValue which was called 1745 times, avg 4µs/call: # 1697 times (6.90ms+0s) by Foswiki::Prefs::TopicRAM::insert at line 82 of /var/www/foswiki11/lib/Foswiki/Prefs/TopicRAM.pm, avg 4µs/call # 48 times (184µs+0s) by Foswiki::Prefs::HASH::insert at line 57 of /var/www/foswiki11/lib/Foswiki/Prefs/HASH.pm, avg 4µs/call
sub cleanupInsertValue {
1141745761µs my ( $this, $value_ref ) = @_;
115
1161745482µs return unless defined $$value_ref;
117
11817451.24ms $$value_ref =~ tr/\r//d; # Delete \r
1191745547µs $$value_ref =~ tr/\t/ /; # replace TAB by space
1201745928µs $$value_ref =~ s/([^\\])\\n/$1\n/g; # replace \n by new line
1211745579µs $$value_ref =~ s/([^\\])\\\\n/$1\\n/g; # replace \\n by \n
12217456.73ms $$value_ref =~ tr/`//d; # filter out dangerous chars
123}
124
12512µs1;
126__END__