Filename | /var/www/foswikidev/core/lib/Assert.pm |
Statements | Executed 13 statements in 571µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.70ms | 2.17ms | BEGIN@16 | Assert::
1 | 1 | 1 | 23µs | 47µs | BEGIN@8 | Assert::
1 | 1 | 1 | 17µs | 37µs | BEGIN@13 | Assert::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | package Assert; | ||||
3 | |||||
4 | # Significant performance gains are delivered by exporting a constant | ||||
5 | # DEBUG to the calling module rather than an subroutine, which the perl | ||||
6 | # optimiser fails to see as a constant. | ||||
7 | |||||
8 | 2 | 79µs | 2 | 71µs | # spent 47µs (23+24) within Assert::BEGIN@8 which was called:
# once (23µs+24µs) by Foswiki::BEGIN@46 at line 8 # spent 47µs making 1 call to Assert::BEGIN@8
# spent 24µs making 1 call to strict::import |
9 | |||||
10 | 1 | 1µs | our $VERSION = "1.200"; | ||
11 | 1 | 29µs | $VERSION = eval $VERSION; # spent 4µs executing statements in string eval | ||
12 | |||||
13 | 2 | 90µs | 2 | 58µs | # spent 37µs (17+20) within Assert::BEGIN@13 which was called:
# once (17µs+20µs) by Foswiki::BEGIN@46 at line 13 # spent 37µs making 1 call to Assert::BEGIN@13
# spent 20µs making 1 call to Exporter::import |
14 | 1 | 12µs | our @ISA = ('Exporter'); | ||
15 | |||||
16 | 2 | 259µs | 2 | 2.24ms | # spent 2.17ms (1.70+472µs) within Assert::BEGIN@16 which was called:
# once (1.70ms+472µs) by Foswiki::BEGIN@46 at line 16 # spent 2.17ms making 1 call to Assert::BEGIN@16
# spent 66µs making 1 call to constant::import |
17 | 1 | 2µs | our @EXPORT = qw(ASSERT UNTAINTED TAINT DEBUG); | ||
18 | |||||
19 | 1 | 500ns | our $soft = 0; | ||
20 | |||||
21 | # Easier than farting about with AUTOLOAD; pull in the implementation we want, | ||||
22 | # either AssertOn or AssertOff | ||||
23 | 1 | 90µs | require 'Assert' . ( DEBUG ? 'On' : 'Off' ) . '.pm'; | ||
24 | |||||
25 | =begin TML | ||||
26 | ---++ DEBUG | ||||
27 | Constant indicating whether asserts are currently active. This constant is | ||||
28 | set at the start of the program run from the environment variable | ||||
29 | FOSWIKI_ASSERTS. | ||||
30 | |||||
31 | ---++ ASSERT(condition [, message]) if DEBUG | ||||
32 | Assert that =condition= returns true. =message= is used to generate a 'friendly' | ||||
33 | error message if it is provided. The =if DEBUG= is required to give the perl | ||||
34 | optimiser a chance to eliminate this function call if asserts are not enabled. | ||||
35 | |||||
36 | ---++ TAINT($val) -> $var | ||||
37 | Generate a tainted version of the variable with the same value. | ||||
38 | |||||
39 | ---++ UNTAINTED($val) -> $boolean | ||||
40 | Return true if the vaue passed is untainted. | ||||
41 | |||||
42 | =cut | ||||
43 | |||||
44 | 1 | 8µs | 1; | ||
45 | __END__ |