Filename | /usr/local/src/github.com/foswiki/core/lib/Foswiki/Plugins/SpreadSheetPlugin.pm |
Statements | Executed 4605 statements in 18.6ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1151 | 1 | 1 | 16.9ms | 19.4ms | commonTagsHandler | Foswiki::Plugins::SpreadSheetPlugin::
1131 | 1 | 1 | 2.55ms | 2.55ms | CORE:match (opcode) | Foswiki::Plugins::SpreadSheetPlugin::
1 | 1 | 1 | 48µs | 359µs | initPlugin | Foswiki::Plugins::SpreadSheetPlugin::
1 | 1 | 1 | 30µs | 322µs | BEGIN@11 | Foswiki::Plugins::SpreadSheetPlugin::
1 | 1 | 1 | 29µs | 38µs | BEGIN@7 | Foswiki::Plugins::SpreadSheetPlugin::
1 | 1 | 1 | 20µs | 44µ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 | 50µs | 2 | 48µs | # spent 38µs (29+10) within Foswiki::Plugins::SpreadSheetPlugin::BEGIN@7 which was called:
# once (29µs+10µs) by Foswiki::Plugin::BEGIN@2 at line 7 # spent 38µs making 1 call to Foswiki::Plugins::SpreadSheetPlugin::BEGIN@7
# spent 10µs making 1 call to strict::import |
8 | 2 | 95µs | 2 | 68µs | # spent 44µs (20+24) within Foswiki::Plugins::SpreadSheetPlugin::BEGIN@8 which was called:
# once (20µs+24µs) by Foswiki::Plugin::BEGIN@2 at line 8 # spent 44µs making 1 call to Foswiki::Plugins::SpreadSheetPlugin::BEGIN@8
# spent 24µs making 1 call to warnings::import |
9 | |||||
10 | # ========================= | ||||
11 | 1 | 292µs | # spent 322µs (30+292) within Foswiki::Plugins::SpreadSheetPlugin::BEGIN@11 which was called:
# once (30µs+292µs) by Foswiki::Plugin::BEGIN@2 at line 13 # spent 292µs making 1 call to vars::import | ||
12 | $web $topic $user $installWeb $debug $skipInclude $doInit | ||||
13 | 2 | 590µs | 1 | 322µs | ); # spent 322µs making 1 call to Foswiki::Plugins::SpreadSheetPlugin::BEGIN@11 |
14 | |||||
15 | 1 | 2µs | our $VERSION = '$Rev$'; | ||
16 | 1 | 1µs | our $RELEASE = '1.1.3'; | ||
17 | 1 | 2µs | our $NO_PREFS_IN_TOPIC = 1; | ||
18 | 1 | 2µs | our $SHORTDESCRIPTION = | ||
19 | 'Add spreadsheet calculations like "$SUM($ABOVE())" to Foswiki tables and other topic text'; | ||||
20 | |||||
21 | 1 | 1µs | $doInit = 0; | ||
22 | |||||
23 | # ========================= | ||||
24 | # spent 359µs (48+311) within Foswiki::Plugins::SpreadSheetPlugin::initPlugin which was called:
# once (48µs+311µs) by Foswiki::Plugin::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Plugin.pm:235] at line 228 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Plugin.pm | ||||
25 | 9 | 42µs | ( $topic, $web, $user, $installWeb ) = @_; | ||
26 | |||||
27 | # check for Plugins.pm versions | ||||
28 | if ( $Foswiki::Plugins::VERSION < 1 ) { | ||||
29 | Foswiki::Func::writeWarning( | ||||
30 | "Version mismatch between SpreadSheetPlugin and Plugins.pm"); | ||||
31 | return 0; | ||||
32 | } | ||||
33 | |||||
34 | # Get plugin debug flag | ||||
35 | 1 | 133µs | $debug = Foswiki::Func::getPreferencesFlag("SPREADSHEETPLUGIN_DEBUG") || 0; # spent 133µ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 | 99µs | $skipInclude = # spent 99µs making 1 call to Foswiki::Func::getPreferencesFlag | ||
54 | Foswiki::Func::getPreferencesFlag("SPREADSHEETPLUGIN_SKIPINCLUDE"); | ||||
55 | 1 | 78µs | my $skipIncludePref = # spent 78µs making 1 call to Foswiki::Func::getPreferencesValue | ||
56 | Foswiki::Func::getPreferencesValue("SPREADSHEETPLUGIN_SKIPINCLUDE"); | ||||
57 | $skipInclude = 1 unless defined $skipIncludePref && $skipIncludePref ne ''; | ||||
58 | |||||
59 | # Plugin correctly initialized | ||||
60 | Foswiki::Func::writeDebug( | ||||
61 | "- Foswiki::Plugins::SpreadSheetPlugin::initPlugin( $web.$topic ) is OK" | ||||
62 | ) if $debug; | ||||
63 | $doInit = 1; | ||||
64 | return 1; | ||||
65 | } | ||||
66 | |||||
67 | # ========================= | ||||
68 | # spent 19.4ms (16.9+2.55) within Foswiki::Plugins::SpreadSheetPlugin::commonTagsHandler which was called 1151 times, avg 17µs/call:
# 1151 times (16.9ms+2.55ms) by Foswiki::Plugin::invoke at line 287 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Plugin.pm, avg 17µs/call | ||||
69 | ### my ( $text, $topic, $web ) = @_; # do not uncomment, use $_[0], $_[1]... instead | ||||
70 | |||||
71 | 3433 | 11.7ms | Foswiki::Func::writeDebug( | ||
72 | "- SpreadSheetPlugin::commonTagsHandler( $_[2].$_[1] )") | ||||
73 | if $debug; | ||||
74 | |||||
75 | 20 | 140µs | if ( ( $_[3] ) && ($skipInclude) ) { | ||
76 | |||||
77 | # bail out, handler called from an %INCLUDE{}% | ||||
78 | return; | ||||
79 | } | ||||
80 | 1131 | 5.99ms | 1131 | 2.55ms | unless ( $_[0] =~ /%CALC\{.*?\}%/ ) { # spent 2.55ms making 1131 calls to Foswiki::Plugins::SpreadSheetPlugin::CORE:match, avg 2µs/call |
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 | 7µs | 1; | ||
96 | |||||
97 | __END__ | ||||
# spent 2.55ms within Foswiki::Plugins::SpreadSheetPlugin::CORE:match which was called 1131 times, avg 2µs/call:
# 1131 times (2.55ms+0s) by Foswiki::Plugins::SpreadSheetPlugin::commonTagsHandler at line 80, avg 2µs/call |