Filename | /var/www/foswiki11/lib/Foswiki/Plugins/SpreadSheetPlugin.pm |
Statements | Executed 56 statements in 642µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
13 | 1 | 1 | 131µs | 131µs | commonTagsHandler | Foswiki::Plugins::SpreadSheetPlugin::
1 | 1 | 1 | 60µs | 237µs | initPlugin | Foswiki::Plugins::SpreadSheetPlugin::
1 | 1 | 1 | 18µs | 88µs | BEGIN@11 | Foswiki::Plugins::SpreadSheetPlugin::
1 | 1 | 1 | 15µs | 30µs | BEGIN@7 | Foswiki::Plugins::SpreadSheetPlugin::
1 | 1 | 1 | 13µs | 52µs | BEGIN@15 | Foswiki::Plugins::SpreadSheetPlugin::
1 | 1 | 1 | 10µs | 16µs | BEGIN@8 | Foswiki::Plugins::SpreadSheetPlugin::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | # | ||||
3 | # This is Foswiki's Spreadsheet Plugin. | ||||
4 | |||||
5 | package Foswiki::Plugins::SpreadSheetPlugin; | ||||
6 | |||||
7 | 2 | 30µs | 2 | 44µs | # spent 30µs (15+14) within Foswiki::Plugins::SpreadSheetPlugin::BEGIN@7 which was called:
# once (15µs+14µs) by Foswiki::Plugin::BEGIN@2 at line 7 # spent 30µs making 1 call to Foswiki::Plugins::SpreadSheetPlugin::BEGIN@7
# spent 14µs making 1 call to strict::import |
8 | 2 | 39µs | 2 | 21µs | # spent 16µs (10+5) within Foswiki::Plugins::SpreadSheetPlugin::BEGIN@8 which was called:
# once (10µs+5µs) by Foswiki::Plugin::BEGIN@2 at line 8 # spent 16µs making 1 call to Foswiki::Plugins::SpreadSheetPlugin::BEGIN@8
# spent 5µs making 1 call to warnings::import |
9 | |||||
10 | # ========================= | ||||
11 | 1 | 12µs | 1 | 70µs | # spent 88µs (18+70) within Foswiki::Plugins::SpreadSheetPlugin::BEGIN@11 which was called:
# once (18µs+70µs) by Foswiki::Plugin::BEGIN@2 at line 13 # spent 70µs making 1 call to vars::import |
12 | $web $topic $user $installWeb $debug $skipInclude $doInit | ||||
13 | 1 | 25µs | 1 | 88µs | ); # spent 88µs making 1 call to Foswiki::Plugins::SpreadSheetPlugin::BEGIN@11 |
14 | |||||
15 | 3 | 359µs | 3 | 101µs | # spent 52µs (13+40) within Foswiki::Plugins::SpreadSheetPlugin::BEGIN@15 which was called:
# once (13µs+40µs) by Foswiki::Plugin::BEGIN@2 at line 15 # spent 52µs making 1 call to Foswiki::Plugins::SpreadSheetPlugin::BEGIN@15
# spent 40µs making 1 call to version::import
# spent 9µs making 1 call to version::vxs::declare |
16 | 1 | 300ns | our $RELEASE = '1.1.7'; | ||
17 | 1 | 200ns | our $NO_PREFS_IN_TOPIC = 1; | ||
18 | 1 | 200ns | our $SHORTDESCRIPTION = | ||
19 | 'Add spreadsheet calculations like "$SUM($ABOVE())" to Foswiki tables and other topic text'; | ||||
20 | |||||
21 | 1 | 100ns | $doInit = 0; | ||
22 | |||||
23 | # ========================= | ||||
24 | # spent 237µs (60+177) within Foswiki::Plugins::SpreadSheetPlugin::initPlugin which was called:
# once (60µs+177µs) by Foswiki::Plugin::__ANON__[/var/www/foswiki11/lib/Foswiki/Plugin.pm:241] at line 234 of /var/www/foswiki11/lib/Foswiki/Plugin.pm | ||||
25 | 1 | 4µs | ( $topic, $web, $user, $installWeb ) = @_; | ||
26 | |||||
27 | # check for Plugins.pm versions | ||||
28 | 1 | 36µs | 1 | 19µs | if ( $Foswiki::Plugins::VERSION < 1 ) { # spent 19µs making 1 call to version::vxs::VCMP |
29 | Foswiki::Func::writeWarning( | ||||
30 | "Version mismatch between SpreadSheetPlugin and Plugins.pm"); | ||||
31 | return 0; | ||||
32 | } | ||||
33 | |||||
34 | # Get plugin debug flag | ||||
35 | 1 | 17µs | 1 | 80µs | $debug = Foswiki::Func::getPreferencesFlag("SPREADSHEETPLUGIN_DEBUG") || 0; # spent 80µs making 1 call to Foswiki::Func::getPreferencesFlag |
36 | |||||
37 | # Following code is for a registered tag handler that does the same as | ||||
38 | # CALC but in a tag handler instead of in commonTagsHandler. That means | ||||
39 | # you can't use table references, but you can rely on the execution order | ||||
40 | # relative to other macros. | ||||
41 | # Foswiki::Func::registerTagHandler( | ||||
42 | # "SSP", | ||||
43 | # sub { | ||||
44 | # my ( $session, $attributes, $topic, $web ) = @_; | ||||
45 | # require Foswiki::Plugins::SpreadSheetPlugin::Calc; | ||||
46 | # $Foswiki::Plugins::SpreadSheetPlugin::Calc::rPos = 0; | ||||
47 | # $Foswiki::Plugins::SpreadSheetPlugin::Calc::cPos = 0; | ||||
48 | # return Foswiki::Plugins::SpreadSheetPlugin::Calc::doCalc( | ||||
49 | # $attributes->{_DEFAULT}); | ||||
50 | # }); | ||||
51 | |||||
52 | # Flag to skip calc if in include | ||||
53 | 1 | 2µs | 1 | 43µs | $skipInclude = # spent 43µs making 1 call to Foswiki::Func::getPreferencesFlag |
54 | Foswiki::Func::getPreferencesFlag("SPREADSHEETPLUGIN_SKIPINCLUDE"); | ||||
55 | 1 | 2µs | 1 | 34µs | my $skipIncludePref = # spent 34µs making 1 call to Foswiki::Func::getPreferencesValue |
56 | Foswiki::Func::getPreferencesValue("SPREADSHEETPLUGIN_SKIPINCLUDE"); | ||||
57 | 1 | 1µs | $skipInclude = 1 unless defined $skipIncludePref && $skipIncludePref ne ''; | ||
58 | |||||
59 | # Plugin correctly initialized | ||||
60 | 1 | 400ns | Foswiki::Func::writeDebug( | ||
61 | "- Foswiki::Plugins::SpreadSheetPlugin::initPlugin( $web.$topic ) is OK" | ||||
62 | ) if $debug; | ||||
63 | 1 | 500ns | $doInit = 1; | ||
64 | 1 | 7µs | return 1; | ||
65 | } | ||||
66 | |||||
67 | # ========================= | ||||
68 | # spent 131µs within Foswiki::Plugins::SpreadSheetPlugin::commonTagsHandler which was called 13 times, avg 10µs/call:
# 13 times (131µs+0s) by Foswiki::Plugin::invoke at line 294 of /var/www/foswiki11/lib/Foswiki/Plugin.pm, avg 10µs/call | ||||
69 | ### my ( $text, $topic, $web ) = @_; # do not uncomment, use $_[0], $_[1]... instead | ||||
70 | |||||
71 | 13 | 5µs | Foswiki::Func::writeDebug( | ||
72 | "- SpreadSheetPlugin::commonTagsHandler( $_[2].$_[1] )") | ||||
73 | if $debug; | ||||
74 | |||||
75 | 13 | 32µs | if ( ( $_[3] ) && ($skipInclude) ) { | ||
76 | |||||
77 | # bail out, handler called from an %INCLUDE{}% | ||||
78 | return; | ||||
79 | } | ||||
80 | 7 | 65µs | unless ( $_[0] =~ /%CALC\{.*?\}%/ ) { | ||
81 | |||||
82 | # nothing to do | ||||
83 | return; | ||||
84 | } | ||||
85 | |||||
86 | require Foswiki::Plugins::SpreadSheetPlugin::Calc; | ||||
87 | |||||
88 | if ($doInit) { | ||||
89 | $doInit = 0; | ||||
90 | Foswiki::Plugins::SpreadSheetPlugin::Calc::init( $web, $topic, $debug ); | ||||
91 | } | ||||
92 | Foswiki::Plugins::SpreadSheetPlugin::Calc::CALC(@_); | ||||
93 | } | ||||
94 | |||||
95 | 1 | 4µs | 1; | ||
96 | |||||
97 | __END__ |