← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/local/src/github.com/foswiki/core/bin/view
  Run on Sun Dec 4 17:17:59 2011
Reported on Sun Dec 4 17:26:42 2011

Filename/usr/local/src/github.com/foswiki/core/lib/Foswiki/Prefs/BaseBackend.pm
StatementsExecuted 3941 statements in 14.2ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
5502210.3ms12.1msFoswiki::Prefs::BaseBackend::::cleanupInsertValueFoswiki::Prefs::BaseBackend::cleanupInsertValue
1058211.75ms1.75msFoswiki::Prefs::BaseBackend::::CORE:substFoswiki::Prefs::BaseBackend::CORE:subst (opcode)
6322799µs799µsFoswiki::Prefs::BaseBackend::::newFoswiki::Prefs::BaseBackend::new
11134µs78µsFoswiki::Prefs::BaseBackend::::BEGIN@16Foswiki::Prefs::BaseBackend::BEGIN@16
11126µs33µsFoswiki::Prefs::BaseBackend::::BEGIN@14Foswiki::Prefs::BaseBackend::BEGIN@14
11118µs40µsFoswiki::Prefs::BaseBackend::::BEGIN@15Foswiki::Prefs::BaseBackend::BEGIN@15
2118µs8µsFoswiki::Prefs::BaseBackend::::CORE:substcontFoswiki::Prefs::BaseBackend::CORE:substcont (opcode)
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
14251µs241µs
# spent 33µs (26+8) within Foswiki::Prefs::BaseBackend::BEGIN@14 which was called: # once (26µs+8µs) by Foswiki::Prefs::HASH::BEGIN@20 at line 14
use strict;
# spent 33µs making 1 call to Foswiki::Prefs::BaseBackend::BEGIN@14 # spent 8µs making 1 call to strict::import
15269µs263µs
# spent 40µs (18+23) within Foswiki::Prefs::BaseBackend::BEGIN@15 which was called: # once (18µs+23µs) by Foswiki::Prefs::HASH::BEGIN@20 at line 15
use warnings;
# spent 40µs making 1 call to Foswiki::Prefs::BaseBackend::BEGIN@15 # spent 23µs making 1 call to warnings::import
162574µs2122µs
# spent 78µs (34+44) within Foswiki::Prefs::BaseBackend::BEGIN@16 which was called: # once (34µs+44µs) by Foswiki::Prefs::HASH::BEGIN@20 at line 16
use Assert;
# spent 78µs making 1 call to Foswiki::Prefs::BaseBackend::BEGIN@16 # spent 44µ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 799µs within Foswiki::Prefs::BaseBackend::new which was called 63 times, avg 13µs/call: # 42 times (574µs+0s) by Foswiki::Prefs::TopicRAM::new at line 27 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Prefs/TopicRAM.pm, avg 14µs/call # 21 times (225µs+0s) by Foswiki::Prefs::HASH::new at line 26 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Prefs/HASH.pm, avg 11µs/call
sub new {
27189895µs my ( $proto, $values ) = @_;
28 my $class = ref($proto) || $proto;
29
30 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 12.1ms (10.3+1.76) within Foswiki::Prefs::BaseBackend::cleanupInsertValue which was called 550 times, avg 22µs/call: # 325 times (6.01ms+1.02ms) by Foswiki::Prefs::HASH::insert at line 57 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Prefs/HASH.pm, avg 22µs/call # 225 times (4.30ms+738µs) by Foswiki::Prefs::TopicRAM::insert at line 82 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Prefs/TopicRAM.pm, avg 22µs/call
sub cleanupInsertValue {
114374512.6ms my ( $this, $value_ref ) = @_;
115
116 return unless defined $$value_ref;
117
118 $$value_ref =~ tr/\r//d; # Delete \r
119 $$value_ref =~ tr/\t/ /; # replace TAB by space
120531997µs $$value_ref =~ s/([^\\])\\n/$1\n/g; # replace \n by new line
# spent 989µs making 529 calls to Foswiki::Prefs::BaseBackend::CORE:subst, avg 2µs/call # spent 8µs making 2 calls to Foswiki::Prefs::BaseBackend::CORE:substcont, avg 4µs/call
121529761µs $$value_ref =~ s/([^\\])\\\\n/$1\\n/g; # replace \\n by \n
# spent 761µs making 529 calls to Foswiki::Prefs::BaseBackend::CORE:subst, avg 1µs/call
122 $$value_ref =~ tr/`//d; # filter out dangerous chars
123}
124
12515µs1;
126__END__
 
# spent 1.75ms within Foswiki::Prefs::BaseBackend::CORE:subst which was called 1058 times, avg 2µs/call: # 529 times (989µs+0s) by Foswiki::Prefs::BaseBackend::cleanupInsertValue at line 120, avg 2µs/call # 529 times (761µs+0s) by Foswiki::Prefs::BaseBackend::cleanupInsertValue at line 121, avg 1µs/call
sub Foswiki::Prefs::BaseBackend::CORE:subst; # opcode
# spent 8µs within Foswiki::Prefs::BaseBackend::CORE:substcont which was called 2 times, avg 4µs/call: # 2 times (8µs+0s) by Foswiki::Prefs::BaseBackend::cleanupInsertValue at line 120, avg 4µs/call
sub Foswiki::Prefs::BaseBackend::CORE:substcont; # opcode